Re: The Mr Magoo Awards (tpr05a)

[email protected] (Eugene van der Pijll)
Newsgroups perl.golf
Message-ID <[email protected]>
En op 11 september 2002 sprak Greg Allen:
> now how about a quotes/sig file with one line descriptions of golf aphorisms?
> here we go:
> 
> ~$a -- true if ASCII string is non-empty, works for "0"
> [$a^abc] -- toggle a charset by making $a non-empty
> $|++ -- alternately 0 and 1
> $^I -- variable efficiently initialised with -i
> perl -[np] -e 'every line}once;for(list){' -- exploit -n or -p

Just "perl -p" would suffice. Is there any reason you'd want to use this
constuct with -n? Compare:

perl -ne'push @a,foo}for(@a){bar'
perl -e'for(map foo,<>){bar}'

Also:

~~foo -- call foo in scalar context
"a@{[foo]}b" -- interpolate call to foo
v32 -- same as " ", but often different tiebreaker score
$a^$b^$b -- pad $a with "\0"'s to the length of $b


(-ugene

-- 
Hackers do it with fewer instructions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.