Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
so the key will be the num ,if the employee number exists then error. I was doing the following:data ---- Loc num name age car $$ 817 09 Sam 99 TU 300 444 11 Ram 88 CM 7 111 3 Kin 8 RT 88
since I am new to perl , I don't think this is the wise way of doing it , any advice on doing this? thanksmy $empNUM; open(DATA, "data") or die ; open(UPDAT, ">updated") or die; while(<DATA>) { my @line = split(/ /, $_); foreach $line (@line) { if ($line[2] eq $empNum){exit 0;} } }end loop print UPDAT $details; close(DATA); close(UPDAT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: data inside file
by AcidHawk (Vicar) on May 11, 2004 at 20:16 UTC | |
|
Re: data inside file
by mifflin (Curate) on May 11, 2004 at 20:24 UTC | |
|
Re: data inside file
by saintbrie (Scribe) on May 11, 2004 at 23:44 UTC | |
|
Re: data inside file
by nothingmuch (Priest) on May 11, 2004 at 20:05 UTC |