maheshganesh has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perl monks Need help in code we i have written in which I am facing issue on the below one can you please help me.. in which the code is getting stuck.. Please suggest what is wrong in the code..

@{temp}=grep {$_ =~ /#%#/ && $_ !~ /#%#$/} @{temp};

Replies are listed 'Best First'.
Re: issue in regular expression
by choroba (Cardinal) on May 10, 2018 at 13:26 UTC
    It works for me:
    #!/usr/bin/perl use warnings; use strict; use feature qw{ say }; my @temp = do { no warnings 'qw'; qw( a b c #%# #%#a #%#b ) }; @temp = grep /#%#/ && ! /#%#$/, @temp; say "@temp.";
    Output:
    #%#a #%#b.

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
Re: issue in regular expression
by hippo (Archbishop) on May 10, 2018 at 13:54 UTC
Re: issue in regular expression
by Anonymous Monk on May 11, 2018 at 00:39 UTC
    Wich result do you expect?