That makes me happy. :) split() was my first thought, but I wanted to keep it simple for the example(for once), and thought it might actually be faster.
Personally, though, I'd *definitely* use the split()! --- "NYIMI Jose (BMB)" <[EMAIL PROTECTED]> wrote: > > my $prevrec = <>; > > my $key = substr($prevrec,9,3); > > I'd be using split here to avoid hard-coding the string's length > my $key=( split(/\s+/,$prevrec) )[1]; > > > while(<>) { > > my $tmp = substr($_,9,3); > > The same here ... > my $tmp=( split/\s+/ )[1]; > > > next if $key eq $tmp; > > print $prevrec; > > $key = $tmp; > > $prevrec = $_; > > } > > print $prevrec; # either last of same, or only of new! > > > > Somebody double-check me on this? > > José. > > > **** DISCLAIMER **** > > "This e-mail and any attachment thereto may contain information which > is confidential and/or protected by intellectual property rights and > are intended for the sole use of the recipient(s) named above. > Any use of the information contained herein (including, but not > limited to, total or partial reproduction, communication or > distribution in any form) by other persons than the designated > recipient(s) is prohibited. > If you have received this e-mail in error, please notify the sender > either by telephone or by e-mail and delete the material from any > computer". > > Thank you for your cooperation. > > For further information about Proximus mobile phone services please > see our website at http://www.proximus.be or refer to any Proximus > agent. > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]