[Buffalo-pm] one liner

Kevin Christopher bpm at binarymojo.net
Wed Jun 18 13:05:56 CDT 2003


Sorry: I'm resend this so it goes to the list w/o waiting for mailman
admin approval...


That is a great idea.

For one liners, I like
http://www.samag.com/documents/s=1334/samtpjoneliners/

It's not really all one-liners, but it's a neat page. That's where I
first stumbled on one of my favorite perl command line utilities:

perl -de 0

Here's a ST-ish one-liner that I've used sometimes to clear out files I
haven't used in, say, over a week:

perl -e 'unlink $_->[0] for grep { $_->[1] > 7 } map { [ $_, -A ] } <*>'

There might be a short way with rm, but perl is more fun!

Jesse:

1-liner #48 at http://www.samag.com/documents/s=1334/samtpjoneliners/
has:

perl -e 'print "$_\n" for @INC'

an alternative for your 1-liner

perl -e 'print join("\n", @INC), "\n";'

-Kevin

> Sounds like a good idea to me. Might be worth some web searches to see
> if there are some other one-liner tips or lists out there to start
> from or expand on.
>
> The following is a footnote to the one-liner section in "Programming
> Perl".
>
> "These types of scripts are often referred to as "one-liners".  If you
> ever end up hanging out with other Perl programmers, you'll find that
> some of us are quite fond of creating intricate one-liners.  Perl has
> occasionally been maligned as a write-only language because of these
> shenanigans."
>
> So, no shenanigans! :)
>
> Jim
>
>
> On Wednesday, June 18, 2003, at 09:35  AM, Jesse L Farinacci wrote:
>
>> hey guys--since i can't make it to the meetings as i'm not in buffalo
>> for the time being i have been trying to replace my usual exposure to
>> others using perl..  perhaps to increase traffic, and provide more
>> website content, we could start up a weekly thing on the list serv:
>> 'one-liner of the week'  ??  i'll contribute something i like to use,
>> and have actually made it an alias on my shell ('pinc') because it's
>> just cool :-)
>>
>>   perl -e 'print join("\n", @INC), "\n";'
>>
>> i can't recall seeing this anywhere, but if someone else has seen
>> this on another site i may have witnessed it but can not remember.
>> cheers,
>>
>> -jlf
>>
>>
>> --
>>  print "Just Another Perl Hacker.";
>>
>>  Please avoid sending me Word or PowerPoint attachments.
>>  See http://www.gnu.org/philosophy/no-word-attachments.html
>>
>>
> ==========================================
> Jim Brandt
> Administrative Computing Services
> University at Buffalo
>
> _______________________________________________
> Buffalo-pm mailing list
> Buffalo-pm at mail.pm.org
> http://mail.pm.org/mailman/listinfo/buffalo-pm






More information about the Buffalo-pm mailing list