Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^4: Search and Copy

by mikebailey (Initiate)
on Nov 24, 2012 at 21:29 UTC ( #1005428=note: print w/replies, xml ) Need Help??

in reply to Re^3: Search and Copy
in thread Search and Copy

open (OUTPUT, ">Results.txt") open( INFILE, "Textfile.TXT" ) while (<INFILE>) { if ($ARG =~ /(Something.{0,250})/ ) { print OUTPUT $ARG ; } } close (OUTPUT);

The "regexp" suggested is not working.


Replies are listed 'Best First'.
Re^5: Search and Copy
by choroba (Chancellor) on Nov 24, 2012 at 21:55 UTC
    The regex would work if you match it against the right variable. Where is $ARG coming from? Use strict and warnings; and if someone gives you a code, taking just a small part of it if you do not understand the rest would probably not work.
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2016-10-24 05:35 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (303 votes). Check out past polls.