in reply to Splitting and formatting a line
#!/usr/bin/perl -w use strict; my ($ID, $DP, $LN, $FN, $NM); open(EMPLOYEES,"<employees") || die "Cannot Open"; while(<EMPLOYEES>) { if(/(.*):(.*):(.*):(.*):(.*)/) { #Supposed to parse $_ $ID = $1; $DP = $2; $LN = $3; $FN = $4; $NM = $5; print $ID; # print $DP; # print $LN; # So I can see if a value is there print $FN; # print $NM; # print $LN."\t".$FN."\t".$ID."\t".$NM; } } close(EMPLOYEES)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Parsing
by jynx (Priest) on Dec 19, 2001 at 13:19 UTC |