Dr. Claus-Peter Becke wrote:
> foreach (/(\w+)/i) {
> push @words,$&;
> }
> print$q->popup_menu('to_thesaurus', @words);
>
> this solution succeeds in finding and returning the last element...
There are a few problems here:
1. regex should use the /g modifier to find all matches in the stri
lve the problem (for example using the binding operator and if
control structures) showed of how to use an array-variable in a scalar
context. after having used a 5 word string the array variable in which
the elemensts of the string had been stored contained the value 5.
can anybody help me so
I went back to my books to refresh my memory on how to use references. Your
suggestion help a lot, but the subroutine returns wrong values. I did
some small modifications on the codes below
, and tried it. It return perl-5.8.0-80.3.i386.rpm and
samba-2.2.7-5.8.0.i386.rpm, which is wrong because:
how to get the pattern matching correctly.
==
sub select_newer {
my (@remote_packages, @installed_packages);
(@remote_packages, @installed_packages) = @_;
foreach (@installed_packages){
my $i = grep {$_} @remote_packages &&
<[EMAIL PROTECTED]>
To: "Kamali Muthukrishnan" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, April 26, 2002 9:48 AM
Subject: RE: pattern matching for serial number
> well, the second slash should follow immediately after the bracket
L PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: pattern matching for serial number
>
>
> Sorry, while typing I missed the slash, it is there in my code as -
> if ($serial !~ m/[0-9]{3}[A-Z]{2}[0-9]{3} /)
> Is there any thing wrong with this ?
> Kamali
> >>
Sorry, while typing I missed the slash, it is there in my code as -
if ($serial !~ m/[0-9]{3}[A-Z]{2}[0-9]{3} /)
Is there any thing wrong with this ?
Kamali
>>> fliptop <[EMAIL PROTECTED]> 04/26/02 08:54AM >>>
Kamali Muthukrishnan wrote:
> Hi guys :
> I have serial numbers with a pattern : 3 nu
> -Original Message-
> From: Kamali Muthukrishnan [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 26, 2002 9:39 AM
> To: [EMAIL PROTECTED]
> Subject: pattern matching for serial number
>
>
> Hi guys :
> I have serial numbers with a pattern : 3 numbers follo
Kamali Muthukrishnan wrote:
> Hi guys :
> I have serial numbers with a pattern : 3 numbers followed by 2 capital letters
>followed by 3 numbers.
> To validate this -
> if ($serial !~ m/[0-9]{3}[A-Z]{2}[0-9]{3} )
> { # display error ; }
> I get a syntax error.
i think you're missing a
Hi guys :
I have serial numbers with a pattern : 3 numbers followed by 2 capital letters
followed by 3 numbers.
To validate this -
if ($serial !~ m/[0-9]{3}[A-Z]{2}[0-9]{3} )
{ # display error ; }
I get a syntax error.
Can you help me , please ?
Kamali
--
To unsubscribe, e-mail: [EMAI
[reply cc'd to list]
lakshmi nrusimhan wrote:
> Sorry here
> $t="Apple\nMango\n";
> Actually what i mentioned in the output is what i want
> the output to be. I wanna replace
> Apple
> Mango
> by
> some three lines.
> The sequence Apple, Mango shd. be there for
> replacement and it won't
lakshmi nrusimhan wrote:
> Consider the following lines:
>
> Apple
> Mango
> Banana
> Orange
>
> I want to replace line 1, line 2 i.e. (Apple, Mango)
> with hello1\nhello2\nhello3\n.
>
> The output should be:
> hello1
> hello2
> hello3
> Banana
> Orange
>
> I tried something like this:
> $t="
Hi All,
Could anyone tell me how to do the following usinf
Perl.
Consider the following lines:
Apple
Mango
Banana
Orange
I want to replace line 1, line 2 i.e. (Apple, Mango)
with hello1\nhello2\nhello3\n.
The output should be:
hello1
hello2
hello3
Banana
Orange
I tried something like
13 matches
Mail list logo