Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Win32/Linux portability

by thelycaeum (Initiate)
on Aug 06, 2011 at 14:51 UTC ( [id://918941]=note: print w/replies, xml ) Need Help??


in reply to Re: Win32/Linux portability
in thread Win32/Linux portability

Thanks for your replies, I'm new to Perl so I'm not fit with that abbreviated syntax, e.g. "s/\s+\z//". I guess I'll stick with telling chomp how to handle arguments. I thought about something like:
if (uc($^O)=~"WIN") {$/="\r\n"}

Replies are listed 'Best First'.
Re^3: Win32/Linux portability
by Anonymous Monk on Aug 06, 2011 at 15:18 UTC

    I thought about something like:

    No need for that. See perlintro and use

    s/\r\n\z//; # or $line =~ s/\r\n\z//;
      It's been a year, but I still don't get that abbreviated syntax. For example, today I found out that I can easily split strings at each point using
      @foo=split(/\./,$bar);
      But to split at whitespace I can use
      @foo=split(" ",$bar);
      Why is that and what does it mean? I really don't get it, why doesn't
      @foo=split(".",$bar);
      work?

        Please read the documentation for split. Twice. Then if you still have trouble, come back and ask.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-03-19 09:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found