Shaun Bramley wrote at Wed, 25 Sep 2002 22:24:00 +0200: > 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)?
Another than using substr is really to use a regexp: my @year = map /(\d\d\d\d)/, @list; I would prefer it against the substr solution, as it better express what you want to get out of the string. (4 digits representing a year). It has the disadvantage that it is slower than the substr solution. Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]