Thanks Jeff. As per your suggestion I did following.
$test="test@/vobs/pvob_aic"; $ts = ($test =~ m{(.+)\@/}); print "$ts\n"; but again the same output. I am not getting output as "test" Please guide. Regards Irfan. -----Original Message----- From: Jeff Pang [mailto:[EMAIL PROTECTED] Sent: Thursday, December 20, 2007 2:31 PM To: Sayed, Irfan (Irfan); beginners @ perl. org Subject: Re: reg. ex. -----Original Message----- >From: "Sayed, Irfan (Irfan)" <[EMAIL PROTECTED]> >Sent: Dec 20, 2007 4:53 PM >To: "beginners @ perl. org" <beginners@perl.org> >Subject: reg. ex. > >Hi All, > >I have one string like this "test@/vobs/pvob_aic"; > >Now I want only "test" from this string, so I wrote reg. ex. like this > >$test="test@/vobs/pvob_aic"; >$ts = ($test =~ m{(.+)@$}); '$' means end of a line, you shouldn't specify a $ here. > >But I am getting output as 1 not a string "test" > >can some body please give me exact reg.ex. to achieve this > $ perl -Mstrict -le '$_="test@/vobs/pvob_aic"; print $1 if /(.+)\@/' test -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/