in reply to System output variables and newline

Jocqui:

Rather than executing lsscsi twice, you could execute it once, and then split the line into pieces. That way, you'll save one execution of lsscsi, one execution of grep and two executions of awk. It should look something like this:

my $tmp = qx( /usr/bin/lsscsi | grep $dev ); my (undef, undef, undef, $brand, $model, undef) = split /\s+/,$tmp;

The undefs are used to ignore the chunks of the line you don't want.

You can even save the external execution of grep by using the grep built into perl to make it a little more perly.

...roboticus

When your only tool is a hammer, all problems look like your thumb.