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

Re^2: question on File::Find (cd)

by skyworld_chen (Acolyte)
on Oct 31, 2012 at 01:43 UTC ( #1001585=note: print w/replies, xml ) Need Help??


in reply to Re: question on File::Find (cd)
in thread question n File::Find

thank you for your reply. I tried your code and it WORKS! thank you very much and thanks for every one who had replied my questions.

by the way, I would like to do some operation to the file, I tried some code like this:

print "hello 1\n" if (-r $_); my @matching = grep {/$my_pattern/} <$_>;

I failed with this code. I have to

open $filehandle,"<", $_" or die .... my @matching = grep {/$my_pattern/} <$_>;

did I do something wrong? or is there any better way to do grep or similar operateion in the $_? thanks.

Replies are listed 'Best First'.
Re^3: question on File::Find (cd)
by aitap (Deacon) on Oct 31, 2012 at 15:50 UTC
    Use File::Slurp to read a file in one command.
    Sorry if my advice was wrong.

      thanks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001585]
help
Chatterbox?
[shmem]: Discipulus: the <<>> operator is quite new, it is in perl5.24 for instance
[Discipulus]: ah! thanks shmem it works in strawberry 5.24
[shmem]: ah. Introduced in 5.22.0, see perl5220delta
[Discipulus]: if so the previous error is a bit misleading, anyway

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2017-07-21 09:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (320 votes). Check out past polls.