Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: multiple OR match fails

by jwkrahn (Monsignor)
on Jan 31, 2012 at 03:33 UTC ( #950870=note: print w/ replies, xml ) Need Help??


in reply to multiple OR match fails

while(<IN>) { undef ($/); $string=$_;

Because you undef $/ inside the loop that means that the first time through the loop $_ will contain only the first line of the file and the second time through the loop $_ will contain all the rest of the file.

Did you really want to process the file in two chunks like that?


Comment on Re: multiple OR match fails
Download Code
Replies are listed 'Best First'.
Re^2: multiple OR match fails
by bimleshsharma (Beadle) on Jan 31, 2012 at 10:19 UTC

    yes, The input record separator, newline by default. $/ may be set to a value longer than one character in order to match a multi-character delimiter. If $/ is undefined, no record separator is matched, and <FILEHANDLE> will read everything to the end of the current file in one line.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2015-07-30 06:40 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 (270 votes), past polls