in reply to Getting the output of a shell command
ADDED:#!/usr/local/bin/perl -w ## ^^^^ change to your system needs. # for the best results in all your perl scripting # use strict. :) use strict; # edit these to match your needs. Remember # for dos, you will need to change the '/'s # to '\'s my $path = "/tmp"; my $file = "$ENV{HOME}/file.txt"; # open our descriptors. One for the directory # we need to read and one for the file in which # we will spool the directory information out to. opendir(DIR,$path) or die("Cannot open $path\n"); open(OP,">>$file") or die("Cannot open $file for writing\n"); # print out all files matching *.pl to file # descriptor OP (output) from reading the # DIR descriptor pointing back to $path. print OP join("\n",grep(/.*\.pl/,readdir(DIR))); # close our descriptors close(DIR); close(OP);
For the above example, you may need to change the $path and $file variables to work for your windows machine but the rest *should* work just fine.
Edited by Snafu 1607 HRS EDT for completeness
----------
- Jim
|
|---|