in reply to Getting the output of a shell command

It's really much easier than you think.

#!/usr/bin/perl -w use diagnostics ; use strict ; open (DIR, '>> c:\dir\dir.txt') || die "Can't open file; $!" ; print DIR $_ foreach `dir *.pl`; close DIR;

Update: Removed unnecessary comma from print statement.

--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me

Replies are listed 'Best First'.
Re: Re: Getting the output of a shell command
by ellem (Hermit) on Jun 04, 2001 at 22:08 UTC
    Thanks yours worked!

    FYI the comma on line 7 (print DIR,) stopped the script from compiling.

    lmoran@wtsgSPAM.com print "\x{263a}"