in reply to system call with variable interpolation

Worked in both cases here (CentOS 5, zsh 4) ...

#!~/bin/perl5.14.1 use strict; use warnings; my $abc; $abc = `date`; #$abc = "Hello"; print "DATE : $abc\n"; system("echo $abc >> log.txt");

Replies are listed 'Best First'.
Re^2: system call with variable interpolation
by Anonymous Monk on Jul 15, 2011 at 12:09 UTC

    ... even without the pragmas & declaration of the variable ...

    cat ~/p ; rm -f log.txt ; ~/p ; cat log.txt #!~/bin/perl5.14.1 $abc = `date`; #$abc = "Hello"; print "DATE : $abc\n"; system("echo $abc >> log.txt"); __END__ DATE : Fri Jul 15 02:07:45 HST 2011 Fri Jul 15 02:07:45 HST 2011
    ... I note just in case somebody wanted to nit pick.