Shaun Bramley wrote: > Hi all, > > I'm just looking for some confirmation on my regx. > > I have a list ('1992', '1993 (summer)', '1995 fall') and what I want to do > is keep only the first four characters. Will the regx work for me? > > @list =~ s/\s*//; > > Again will that turn the list into (1992, 1993, 1995)? >
you can use substr() to null out from the 5th byte: substr($_,4) = '' for(@list); or you can use the unpack() function which could be a bit faster: print unpack('A4',$_),"\n" for(@list); david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]