Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Need to search for a string in a file

by jwkrahn (Abbot)
on Oct 20, 2011 at 20:38 UTC ( [id://932749]=note: print w/replies, xml ) Need Help??


in reply to Re: Need to search for a string in a file
in thread Need to search for a string in a file

sub get_file_from_log(){ my $log_name=shift; open(my $log_file, "<", $log_name);

Your prototype says to accept NO arguments but your next line says to accept ONE argument.    You should not use prototypes!

You should always verify that open worked correctly before trying to use a possibly invalid filehandle.

open(my $log_file, "<", $log_name); my $file_name; while (<logFile>){

You are opening the filehandle $log_file but you are trying to read from the filehandle logFile?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://932749]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-18 21:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found