in reply to !~ /\w/ challenge, anyone?

perl -lpe "}{${'~'^'!'}=$." file

Note: I get a problem running this under bash, because it interprets the ! incorrectly. But stick it in a file and it will run correctly. e.g.,

#!/usr/bin/perl -lp }{${'~'^'!'}=$.
Update: fixed a typo, and I forgot to put file on the command line. And here's a new version that actually runs on the command line:
perl -lpe '}{${"#"^"|"}=$.' file

-- Mike

--
just,my${.02}

Replies are listed 'Best First'.
Re: Re: !~ /\w/ challenge, anyone?
by John M. Dlugosz (Monsignor) on Feb 05, 2003 at 20:32 UTC
    Very nice, the first post of a practical general way of avoiding $_ instead of griping about it! Not bad as an obfus technique either, especially if you do it with a different pair of chars each time.