On Sun, Dec 23, 2012 at 06:57:38PM +0530, punit jain wrote:
> Hi,
> 
> I am doing grouping but seeing some weird behavior :-
> 
> the strings in a file are like :-
> AccessModes =
> (18,Mail,POP,IMAP,PWD,WebMail,WebSite,Relay,Mobile,FTP,MAPI,TLS,LDAP,WebCAL);
> ....
> ...
> .
> multiple lines
> 
> I am seeing which lines have both POP and Webmail as below :-
> 
> if( $line =~ /AccessModes\s*=\s*.*(WebMail)*.*(POP).*(WebMail)*.*/ ) {
>                             if(defined $2) {
>                                 print "$2 $1"."$line"."\n";
>                             }
>                         }
> 
> 
> However I get these below :-
> 
>   POPUse of uninitialized value in concatenation (.) or string at
> test.plline 283, <GEN85> line 2.
>   POPUse of uninitialized value in concatenation (.) or string at
> test.plline 283, <GEN86> line 2.
>   POPUse of uninitialized value in concatenation (.) or string at
> test.plline 283, <GEN87> line 2.
> 
> Any clue why ?
> 
> Regards.

It's unclear to me why, having specified what you are searching for, you
then ask what was found.  The only reason I can see for doing that would
be to find out in which order you found the items.

In any case, the easiest way to find out whether two substrings appear
in the same same string is to program the way you define the problem:

if (/WebMail/ && /POP/) { ... }

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to