Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: max .. min does not work

by olus (Curate)
on Jul 23, 2008 at 16:19 UTC ( [id://699642]=note: print w/replies, xml ) Need Help??


in reply to max .. min does not work

Above you have the answer you were looking for. But just out of curiosity, if you use the -l option, you won't need to add those \n to the print statements.

perl -le 'for (1..5) { print "$_" };'

Replies are listed 'Best First'.
Re^2: max .. min does not work
by toolic (Bishop) on Jul 23, 2008 at 16:28 UTC
    Nor is it necessary to add "$_" to print, for that matter:
    perl -le 'for (1..5) { print };'

    Update: And golfing down a little more:

    perl -le 'print for(1..5)'
      Nor are the parentheses in this reversed form ;-)
      perl -le 'print for 1..5'
      Update: Of course, we could drop for too, but that won't help golfing: perl -le '$,=$/; print 1..5' :)

      :o) You are right of course. My intention was not to golf the code. It's just that I find that \n a bit messy, and thus just tried to show something a bit cleaner. But yours are pretty readable as well.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-24 17:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found