Christopher Spears wrote:

I want to catch the various parts of the output of the
date command.  Here is my script:

#!/usr/bin/perl -w
use strict;

my $date = system("date");

$date =~ /(\w+)/;

my $day = $1;

print "Day: $day\n";

Here is my output:

Thu Sep  8 10:22:14 CEST 2005
Day: 0

What is going on?  Does this mean that nothing was
captured?

-Chris

You cannot use system to capture output ... use backquotes ( `  ` ) or qx 
operator to do that.
Since  the return value for system is the exit status of the program as returned by the 
"wait" call,
and not the output from the command you've spawned.

*/binish/*

Reply via email to