Charles Belcher wrote:
> 
> I have a file that looks like
> 0
> 232,32387,2323
> 
> I am only interested in the last set of digits on the second line.  My plan
> was to split on coma and take the 3 element of the array. I am having problems
> skipping the fist line.  Any assistance would be appreciated.


It looks like valid data is three fields separated by commas so either
of these should work:

while ( <FILE> ) {
    next unless tr/,// == 2;
    my @fields = split /,/;


while ( <FILE> ) {
    my @fields = split /,/;
    next unless @fields == 3;


while ( <FILE> ) {
    next unless @fields = /^(\d+),(\d+),(\d+)$/;



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to