in reply to Re: identifying null fields in bar delimited records
in thread identifying null fields in bar delimited records
Here's a humble for loop:
#!/usr/bin/perl use strict; use warnings; my $line = "a||c|\t| |d||e"; my @fields = split(/\|/, $line); my @null; for my $i (0..$#fields){ push @null, $i unless $fields[$i]; } print "null fields: ", scalar @null, "\n"; print "at field: "; print ++$_, ", " for @null; # output # null fields: 2 # at field: 2, 7,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: identifying null fields in bar delimited records
by lupey (Monk) on May 31, 2005 at 12:38 UTC | |
by wfsp (Abbot) on May 31, 2005 at 12:50 UTC | |
by holli (Abbot) on May 31, 2005 at 12:53 UTC | |
|
Re^3: identifying null fields in bar delimited records
by jjohhn (Scribe) on May 31, 2005 at 14:04 UTC |