Ariel Casas wrote:
Hello all,

Hello,

Any time I run a unix command where I initiate a variable > use the
variable as an arg in the unix command > pipe it to another unix
command, I get an error.  This is the error I get:

---------------------------------------
./test.1.pl
Use of uninitialized value in concatenation (.) or string at ./test.
1.pl line 8.
sh: syntax error at line 1: `|' unexpected
512
---------------------------------------



-----Here is the contents of the perl script--------

#!/usr/bin/perl -w

The first three lines *should* be:

#!/usr/bin/perl
use warnings;
use strict;


check_LANon () ;

You call the subroutine check_LANon() but you haven't assigned anything to $utadm_l yet.


$utadm_l = "/opt/SUNWut/sbin/utadm -l" ;

sub check_LANon {
        $LANstat = system(" $utadm_l | grep On") ;

What information did you expect that system() would return?


        print "$LANstat\n" ;
}

------------------------------------------------------------

How can I run this succesfuly?  I have other scripts that I need to do
this with as well, but I can't since I always get this error.  If I
substitute $utadm_l with the actual command, it works fine.  Only
barfs when I use a variable.



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to