in reply to Or condition in Perl

You've got:

if($array[$i] =~ /$ .pst/)

This will never match anything. The "$" matches the end of the string. So what you're trying to match is the end of the string, followed by five characters. Clearly you can't have characters after the end of the string!

What you want is:

if($array[$i] =~ /\.(pst|prj)$/)

This matches a literal full stop character, then either "pst" or "prj", and then the end of the string.

Replies are listed 'Best First'.
Re^2: Or condition in Perl
by rajkrishna89 (Acolyte) on Mar 11, 2012 at 09:22 UTC

    Thanks tobyink ..When i tried with the regex each and evry time CONVERT FILE Window is opening ...Any idea where im making wrong..Once again Thanks Dude

      How did you make sure that the problem is related to the regular expression supplied by tobyink?

      Most likely, this is another error in your script that is totally unrelated to the regular expression.

      Maybe you should eliminate all other code and only keep the code that relates to the "convert file window", whatever that is. I don't see your code trying to load or save a file in the block governed by the regular expression, so you are either not showing the relevant code or are misinterpreting how your program behaves.