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

Re: $/ usage

by graff (Chancellor)
on Jan 02, 2013 at 21:41 UTC ( #1011357=note: print w/replies, xml ) Need Help??

in reply to $/ usage

If you were expecting the $/="\n"; at the end of your one-liner to do something, that's your problem. That step doesn't do anything.

The undef $/; at the beginning does make sure that all the data in your list file gets slurped into $text, so when you do print $text; you should see the full content of the list, in its original form (as stored in the file).

Did you want to see something different from that?

Replies are listed 'Best First'.
Re^2: $/ usage
by mimiandi (Novice) on Jan 02, 2013 at 21:54 UTC

    "in its original form" - i was expecting to see something like this: server1 ip server2 ip server3 ip etc..
    I was going to do another pattern match on the string $text after getting it in the string.

    perl -e 'undef $/; my $text=<>; 1 while $text =~ s/\b(\w+\d+)\s*\1\b/$ +1/gi; pring $text; $/="\n";' list
      To get all the lines from a slurped input file to show up as a single line on output, you want something like this:
      perl -e 'undef $/; $_=<>; tr/\n/ /; s/ $/\n/; print' list
      Or you could just use unix/linux commands that do the same thing:
      xargs echo -n < list
      (If you want a clean line break at the end of that output, add  && echo at the end.)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011357]
[Corion]: Oooh. Tinc really looks good. It seems that it could even be used to link up (a segment of) my home network with (a segment of) a friends network, to create a private network over the internet
[marto]: fun times :)

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2018-01-17 15:01 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (201 votes). Check out past polls.