Shawn H. Corey wrote: > Steve Bertrand wrote: >> Sorry for being OT: If it's not too silly or crazy, I think I'm ready to >> follow a golf thread. It doesn't appear as those mail lists do much >> anymore. Would it be too much to ask for someone to start something so >> us newbies could watch and follow along? > > How about some one-liners? > > The Perl Calculator (type 'exit' to quit): > > perl -ple '$_=eval' > > On Windows: > > perl -ple "$_=eval" > > > > The Poor Man's Grep, for when you're on Windows and don't have grep(1): > > perl -nle "beg...@argv=glob(@ARGV)}/PATTERN/&&print" <file_specs> > > Replace PATTERN with the regex you want to search for.
heh. perhaps I asked for too much.
I still write Perl programs in individual files, because I've never
taken the time to learn one-liners.
I don't really understand how perl interprets arguments on the command
line, but here is a one-liner I use to check what subs I have within a
certain project directory:
# egrep -r "sub \w+ {" * | \
grep -v svn | \
awk '{FS="sub"} {print $1, $2}' | \
perl -n0e 's/(.*\/|\.pm|{)//g; print;'
I'm going to completely blame Windows for my inability to properly
understand your one-liner until I figure it out...
Steve
smime.p7s
Description: S/MIME Cryptographic Signature
