You may or may not know about this little (hopefully largely unused) idiom:
perl -le '$FILE = ".bashrc"; open(FILE); print <FILE>'
Since we don't use global variables anymore (right?), this is no longer useful. But wouldn't it be cool if that could work with lexicals? I offer no solution. Just the thought.
one-arg open() (Score:3, Interesting)
open 0has been sighted in programs that print themselves.Reply to This
*0 (Score:4, Informative)
Reply to This
Re:*0 (Score:2)
And what, interesting discussions don't happen on use Perl?
Re:*0 (Score:4, Funny)
Reply to This
Parent
Re:*0 (Score:3, Funny)
An Ugly Lexicalish Solution (Score:3, Interesting)
Here's one shot at it:
perl -e 'my $file = ".bashrc"; open( *FILE = \$file ); print <FILE>'It even works with strict and warnings. It doesn't work with the flags
-ew, though, which should tell you something. (-weworks.)Reply to This