in reply to Re^2: Number of lines from a system call
in thread Number of lines from a system call

If you use backticks in scalar context, like you do, you'll get the whole output in one string. If you use them in list context, you'll get the lines of output as a list.
So what you need is:
my $num = () = qx{/usr/bin/lpstat -h $server -W not-completed};
which puts the number of lines output by the command into $num.
This syntax puts qx{...} into list context and returns the number of elements in the list rather than the list itself.

Besides, why are you using Data::Dumper? This is nice for structured variables, but for plain strings it's more straightforward to write:

print "number is: $num\n";

Replies are listed 'Best First'.
Re^4: Number of lines from a system call
by tcf03 (Deacon) on Mar 16, 2005 at 21:26 UTC
    Thanks.
    I was using Data::Dumper earlier in my code to dump and array, and I just continued using it.