wrote:
> Tad McClellan <> wrote in comp.lang.perl.misc:
>
>>Another solution would be to discard the empty leading field:
>>
>> (undef, $usrcpu, $syscpu, $wiocpu, $idlecpu) = split(/\s+/, $CPU);
>
>
> That is only a solution if the empty field is guaranteed to be present.
> Since we don't know the format of the line, that's not a given.
In these circumstances (parsing /proc/interrupts on a Linux machine),
I've done it like this:
my @f = split(/\s+/, $line);
shift @f unless length $f[0];
Josef
--
These are my personal views and not those of Fujitsu Siemens Computers!
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details:
http://www.fujitsu-siemens.com/imprint.html