Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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?


Comment on Re^4: Search and Copy
Download Code
Replies are listed 'Best First'.
Re^5: Search and Copy
by choroba (Canon) 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?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2015-07-30 10:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls