SPUG: flip-flops
Michael R. Wolf
MichaelRunningWolf at att.net
Thu Feb 14 18:43:55 CST 2002
sthoenna at efn.org (Yitzchak Scott-Thoennes) writes:
> In article <wkr8nqmck3.fsf at att.net>,
> "Michael R. Wolf" <MichaelRunningWolf at att.net> wrote:
> >perl -n -e '$body .= $_ if /^$/ .. eof();' \
> > -e '$head .= $_ if (1 .. /^$/);' \
> > -e 'END{print $head, "\n", "="x40, "\n", $body;}'
>
> How about:
>
> perl -pe'(/^$/..eof&&(close*ARGV||1))==1and$_.=("="x40)."\n"'
Wow!
Do you play Perl golf? Does your editor's perl-mode prevent
unnecessary spaces?
Same output, but doesn't illustrate multiple flip-flops,
which was part of the contrived illustration.
--
Michael R. Wolf
All mammals learn by playing!
MichaelRunningWolf at att.net
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
More information about the spug-list
mailing list