Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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.

Thoughts?

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005428]
help
Chatterbox?
[SuicideJunkie]: email tests, eh? I've gotten dinged for "you can't block this sender as spam, they're internal"
[Corion]: Heh - somebody in our marketing departement thought it was a great idea to use the alerting tool for company-wide outages to announce some new feature ;)

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2017-05-24 14:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?