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

Re^2: How many defaults of $/ does perl have?

by stevieb (Canon)
on Sep 18, 2015 at 23:38 UTC ( [id://1142477]=note: print w/replies, xml ) Need Help??


in reply to Re: How many defaults of $/ does perl have?
in thread How many defaults of $/ does perl have?

perlport Newlines is exactly what I needed to see to start bettering my understanding.

Thanks, AnonyMonk

  • Comment on Re^2: How many defaults of $/ does perl have?

Replies are listed 'Best First'.
Re^3: How many defaults of $/ does perl have?
by AnomalousMonk (Archbishop) on Sep 19, 2015 at 00:18 UTC
    ... to start bettering my understanding.

    If you have access to multiple platforms, a little experimentation can afford insight. Something like Data::Dump::dd can also be helpful. The following is on my Windoze 7 laptop:

    c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "print qq{'x$/y'}; dd $/, $\; " 'x y' ("\n", "\n")

    Update: In the spirit of making sure that what one posts is true, clear and helpful, I thought I'd test my example code with  $/ = "\r\n". The whole idea of the example was that you'd be able to see a difference between "\n" and "\r\n". Not so. Easy to see why when you think about it. I'll have to think of a better example!

    c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "print qq{'wx$/yz'}; dd $/; ;; $/ = qq{\r\n}; print qq{'wx$/yz'}; dd $/; " 'wx yz' "\n" 'wx yz' "\r\n"
    (But at least dd does not mislead.)


    Give a man a fish:  <%-{-{-{-<

      What I've learned, AnomalousMonk, is that I can't take things for granted, and I now have an intrinsic desire to ensure anything I publish from now on works on the standard platforms.

      I plan on testing the Record Separator for my own knowledge, but this was an awakening to so many things that I've been blind to that are supposedly taken for granted by some.

      You're always one to point things out to me to which I learn from, so thanks.

      This is technically a huge sweeping XY Problem, with me wanting to grasp the parts of Perl that might allow me to understand other parts of Perl :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-23 15:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found