hi all, can anyone tel me how to look for files which conatain dotsin it. i.e file1.txt file2.txt how to check for dots in filename using regular expression. is it correct
my $ty=polica.op if($ty =m/ (.*)\.o/)
The regular expresion should be /(.*)\.o/. Otherwise you'll try to match a filename beginning with a space.
Can probably dispense with the (.*) at the beginning, and you may want to anchor the '\.o' at the end, otherwise you will match filenames that have a '.o' embedded, like 'filename.ok.txt'...
/\.o$/
If you want to make sure that there is something before the initial dot, then you need to switch the * to a +, and can probably avoid the grouping, unless you need it for something else,
/.+\.o/
Of course, to answer the question precisely, if you just want to see if a filename contains a dot, without specifying where, then just
/\./
Should work.
perldoc perlretut perldoc perlre
http://danconia.org
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>