Hi, Bob, :)

This is so great!

On Thu, 13 Sep 2001, Bob Showalter wrote:
> > -----Original Message-----

> >   In a directory there exist *.c and *.out files. Here *.out is
> > created for every *.c file. I need to check whether .out is
> > generated for all the .c file.  How to achive this.

> perl -e '-f $_ || print "Missing $_\n" for map {/^(.*)\.c$/; "$1.out"}
> @ARGV' *.c

Cool!  I had never heard of the 'map' function before (sounds
stdlib'ish).  New (to me) stuff!  Guess that's why I'm on the
"beginners" list. :)

After I read the perlfunc page on 'map', I discovered you could
rewrite the above even more minimally:

perl -e 'map { /^(.*)\.c$/; -f "$1.out" || print "Missing $1.out\n"; } @ARGV;' *.c

Man, perl has so many different ways to say the same thing...

Thanks!

---Jason


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to