Jocqui has asked for the wisdom of the Perl Monks concerning the following question:
Have the following code and i wish that the variable that store the system output to be places in a single variable. However a newline is printer at the end of each variableso i get the following when i print brand model size
#!/usr/bin/perl use strict; use warnings; my $dcr = "na"; my $dev= "/dev/sdc" ; my $brand = qx(/usr/bin/lsscsi | grep $dev |awk '{print \$4}' ) ; my $model = qx(/usr/bin/lsscsi | grep $dev |awk '{print \$5}' ) ; my $disk_size = `/sbin/parted $dev -s print | grep Disk | awk '{pr +int \$3}' `; $dcr = "$brand $model $disk_size"; print "$dcr";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: System output variables and newline
by roboticus (Chancellor) on Jul 08, 2014 at 01:45 UTC | |
|
Re: System output variables and newline (remove newlines)
by Anonymous Monk on Jul 07, 2014 at 20:56 UTC | |
|
Re: System output variables and newline
by AppleFritter (Vicar) on Jul 07, 2014 at 21:45 UTC |