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

Re^5: pattern search in all the files in a directory

by 2teez (Priest)
on Feb 19, 2013 at 14:33 UTC ( #1019578=note: print w/ replies, xml ) Need Help??


in reply to Re^4: pattern search in all the files in a directory
in thread pattern search in all the files in a directory

  • The perl function chomp chomps $_ if variables are omitted i.e chomp($_) can be written simply as chomp;
  • Use 3 argument open function and also check the return of the open function like so
    open my $fh, "<", $file_name or die "can't open file: $!"; while(<$fh>){ chomp; ... } ...

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me


Comment on Re^5: pattern search in all the files in a directory
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (15)
As of 2015-07-07 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls