Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: Win32/Linux portability

by Anonymous Monk
on Aug 06, 2011 at 15:18 UTC ( [id://918943]=note: print w/replies, xml ) Need Help??


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

I thought about something like:

No need for that. See perlintro and use

s/\r\n\z//; # or $line =~ s/\r\n\z//;

Replies are listed 'Best First'.
Re^4: Win32/Linux portability
by thelycaeum (Initiate) on Oct 01, 2012 at 19:38 UTC
    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.

        I read it more than twice, before. It says "However, this special treatment can be avoided by specifying the pattern / / instead of the string " " , thereby allowing only a single space character to be a separator." To me that means that for one or more ".", "." should work as well, or is there something special about a "." compared to a " "?

Log In?
Username:
Password:

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

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

    No recent polls found