Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1019578]
[LanX]: what's strange is that the "Cowboy you said this already" message is missing #dqiwd
[LanX]: YM: BTW learn to mute your humanity
[Your Mother]: Cumin? Now I want tacos...
[Eily]: there should be an option in grep for fuzzy order of the letters in the pattern
[Eily]: as in "I might have inverted two, but my eyes misread in the some order as my fingers mistype"
[LanX]: can't find a definition for the sound

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2017-03-27 16:58 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.