Try moving $utadm_1 up a few lines, before calling the subroutine.
#!/usr/bin/perl -w
$utadm_l = "/opt/SUNWut/sbin/utadm -l" ;
check_LANon () ;
sub check_LANon {
$LANstat = system(" $utadm_l | grep On") ;
print "$LANstat\n" ;
}
Dave
On Tue, 21 Oct 2008 03:06:34 +1000, Ariel Casas <[EMAIL PROTECTED]>
wrote:
Hello all,
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
check_LANon () ;
$utadm_l = "/opt/SUNWut/sbin/utadm -l" ;
sub check_LANon {
$LANstat = system(" $utadm_l | grep On") ;
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.
Thanks all!
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/