Perl match pattern

Hi all,

i have a peice of Perl script like this:

 foreach (@line) {
                @tmp = split /;/,$_;
                #print "Line is: $_\n";
                switch($tmp[3]){
                                case m/p60/i {
                                push @p60, [ $tmp[1], $tmp[4] ];
                                }

I want to match the string "p60" even if it was written with any whitespaces, for example: "p 60", or "p 60" etc...
Is there any way to add this feature of deleting whitespaces at "case m/........."??

Thank you in advance!!
Ervin

try this

 
m/p[ ]*60/i
 
m/p\s*60/i

or

m/p\s*60/i

thank you replying!

but i want to count p60 even if it is written like this "p[][][][][][][][][][][][][]60" or "[][][][][][][][][][][][][][][]p[][][][][][[]60 [][][][][][][][]". I mean every white spaces to be deleted.

Thank you very much!!

p.s: [] is whitespace.

 
m/\s*p\s*6\s*0/

thank you, but it doesnt work. it count 0 of p60 :frowning:

what about the below ?

in the switch, you are checking only one pattern. so no need of switch

push @p60, [ $tmp[1], $tmp[4] ] if ($tmp[3]=~m/\s*p\s*6\s*0/i)

Thank you very much!!

This solutions : m/\s*p\s*6\s*0/ worked perfectly!!

Thank you!!!