Try this if you want regex.
This may not be the appropriate but works.
@list = ('1992','1993 (summer)','1995 fall');
foreach (@list) {
push @array, $1 if $_ =~ /(\d+)\s*.*$/;
}
print map {$_,"\n"} @array;
regards
Rajendran
Burlingame,CA
- Original Message -
From: "Shaun Bramley" <[
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
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 in
> -Original Message-
> From: Shaun Bramley [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 25, 2002 4:24 PM
> To: [EMAIL PROTECTED]
> Subject: Help with regular expression
>
>
> Hi all,
>
> I'm just looking for some confirmation on my regx.
>
> I have a list ('1992', '1993 (sum
Nope..this won't work. Why don't you loop over the list and do a substring or pack as
you know that you need to keep only the first 4 characters of each element?
-Original Message-
From: Shaun Bramley [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 25, 2002 4:24 PM
To: [EMAIL PROTE
On Fri, 5 Oct 2001, Daniel Falkenberg wrote:
> List,
>
> I have an IP address within this regular expression that I need
> extracting and stored in a variable. Could some one offer some help on
> this? The line is as follows...
>
> inet addr:144.137.215.25 P-t-P:172.31.28.24
> Mask:2
You are looking for the word addr: followed by four groups of digits, three
of which are separated by a dot. Therefore you want
$string =~ /addr:(\d+\.\d+.\d+\.\d+)/;
Now, $1 has the correct ip address.
-Original Message-
From: Daniel Falkenberg
To: [EMAIL PROTECTED]
Sent: 10/4/2001 6:4