Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: $/ variable

by reyjrar (Hermit)
on Aug 21, 2001 at 21:15 UTC ( [id://106649]=note: print w/replies, xml ) Need Help??


in reply to $/ variable

Well, $/ is the input record seperator, its what things like <> use to determine when to iterate to the next record. Default is "\n". some examples:

A) echo 'blah;hi;blah;' |perl -e 'while(<>) { print "$_\n"; }' vs. B) echo 'blah;hi;blah;' |perl -e '$/=";";while(<>) { print "$_\n"; }'
A outputs:
blah;hi;blah;

B outputs:
blah;
hi;
blah;

If you're interessted in changing this value, you might also look at split() which is generally safer to use (especially if you're not using strict and warnings).

-brad..

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-25 14:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found