Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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

by AnomalousMonk (Chancellor)
on Sep 19, 2015 at 00:18 UTC ( #1142481=note: print w/replies, xml ) Need Help??

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

... 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:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^4: How many defaults of $/ does perl have?
by stevieb (Abbot) on Sep 19, 2015 at 00:29 UTC

    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?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2018-08-16 04:39 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (166 votes). Check out past polls.