Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: returning word from a file position

by maverick (Curate)
on Jan 22, 2002 at 10:21 UTC ( #140606=note: print w/replies, xml ) Need Help??


in reply to returning word from a file position

change:
( $word1 ) = $file =~ /EditorName\b.+\b(\s*)/;
to:
( $word1 ) = ($file =~ /EditorName\b(.+?)\b\s*/);
to extract the thing matched in the ( ) the =~ has to be in array context, thus the parens. In scalar context you get the number of matches. Aside from that, I suspect that you really want the .+ part, not the \s* part. Also .+ will match as much as it can, which is probably more than you want, so the ? makes it match as little as it can...just the stuff between the two \b's.

HTH

/\/\averick
perl -l -e "eval pack('h*','072796e6470272f2c5f2c5166756279636b672');"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://140606]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2018-06-24 04:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (126 votes). Check out past polls.

    Notices?