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.