[kw-pm] Last night's meeting
abez
abez at abez.ca
Fri Jun 19 07:29:12 PDT 2009
So AWK's FNR is equal to perl's $.
That's neat, thanks for that :)
abram
Raymond wrote:
> (Replying to all this time, oops)
>
>>From the above:
>
> $ perl -ne'rand++$n<1?$s=$_:1;END{print$s}' <alpha.html
>
> No need to increment a counter like $n, just use $. which gives the
> line number 1 indexed.
>
> $ perl -ne'rand$.<1?$a=$_:1;END{print$a}' <alpha.html
>
> Also replaced $s with $a so it runs safe under 'warnings'. ;) Two more
> characters saved.
> _______________________________________________
> kw-pm mailing list
> kw-pm at pm.org
> http://mail.pm.org/mailman/listinfo/kw-pm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://mail.pm.org/pipermail/kw-pm/attachments/20090619/60bc6373/attachment.bin>
More information about the kw-pm
mailing list