in reply to Duplicate data record
I haven't tested this code, but hope that it will work...my $name = "britney"; my $file = "record.txt"; unless (open (FILE, $file)){ print "Error: couldn't open file $file: $!"; } else { my $nameFound = 0; foreach my $entry(<FILE>){ if ( /^\Q$name\|/i ){ $nameFound = $entry; last; } } if ($nameFound){ my($name, $telephone, $email) = split(/\|/, $nameFound); # do something with $name, $telephone, $email if you want } else { print "not found\n"; } } # else
Best regards,
perl -e "print a|r,p|d=>b|p=>chr 3**2 .7=>t and t"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Duplicate data record
by Juerd (Abbot) on Dec 20, 2001 at 18:45 UTC | |
by strat (Canon) on Dec 20, 2001 at 19:03 UTC | |
by Juerd (Abbot) on Dec 20, 2001 at 19:09 UTC | |
by strat (Canon) on Dec 20, 2001 at 19:21 UTC | |
by britney (Acolyte) on Dec 22, 2001 at 03:39 UTC |