in reply to Replaying Santa Claus Golf Apocalypse with Pugs/Perl6
It seems to pass all tests for current Pugs svn build.my@l=(open@ARGS[0]).readline(); my$i;$i=@l-10 if@l>10; say@l[$i..Inf];
Update: After discovering that the good old ternary operator was renamed to ?? ::, I came up with the slightly more elegant solution:
This is exactly one character shorter...:-)my@l=(open@ARGS[0]).readline(); my$i=@l>10??@l-10::0; say@l[$i..Inf];
Update2: I have just discovered the = $filehandle operator in list context, so, take this one:
my@l= =open@ARGS[0]; my$i=@l>10??@l-10::0; say@l[$i..Inf];
In fact, my@l==open@ARGS[0]; seems to work too, but, in my opinion, this should better be a bug...
rg0now
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Replaying Santa Claus Golf Apocalypse with Pugs/Perl6
by TimToady (Parson) on Mar 12, 2005 at 16:57 UTC | |
by rg0now (Chaplain) on Mar 12, 2005 at 17:21 UTC | |
by audreyt (Hermit) on Mar 12, 2005 at 18:10 UTC |