Jeff Abrahamson on Thu, 17 Jul 2003 12:50:46 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

backtick weirdness


Here's a code snippet. It's ugly, quick, and dirty, but I would expect
to see the results of running $cmd appear on stdout and in the file to
which its output is redirected. In fact, I see nothing on stdout or in
the file, although $cmd is run.

    print "$cmd\n";
    if(1) {
        my $errors = `$cmd`;
        print "Errors: $errors\n" if($errors);
        my $cat = 'cat ' . output_name();
        `$cat`;
        my $ann = annotation_name();
        `echo $cmd > $ann`;
    }

$cmd is

    /home/jeff/work/PDA/cctl/cctl-bin 1058459574.00001.dat 1058459574.00002.dat pda 0.5 0 > 1058459574.00002.out


A related oddity, at another point in the program I said

    my $dir=`pwd`; chomp($dir);

and found $dir to be empty. I changed it to

    my $dir=cwd();

and it worked.


Any idea what is going on here?

-- 
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>
 GPG fingerprint: 1A1A BA95 D082 A558 A276  63C6 16BF 8C4C 0D1D AE4B
-
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**