in reply to Re^4: extract and export to multiple files
in thread extract and export to multiple files

Show me some sample code that fails. It works as expected for me:

use strict; use warnings; for my $str ("DESIGN & PLAN:", "DESIGN/PLAN:", "DESIGN PLAN") { print "Matched $str\n" if $str =~ /^[A-Z &\/]+[:|;]/; }

Prints:

Matched DESIGN & PLAN: Matched DESIGN/PLAN:

The last string doesn't match because there isn't a trailing colon or semi-colon.

True laziness is hard work

Replies are listed 'Best First'.
Re^6: extract and export to multiple files
by zzgulu (Novice) on Apr 10, 2010 at 15:47 UTC
    Thank you Grandfather. It turned out CR and LF were the problem in that specific file that contained ampersand character. The text files are coming from an IBM mainframe with Mac(LF) encoding. By the way, I had to preprocess and remove "/" from $titles before running your script since they are not accepted as a valid character in a file name. I converted them into "OR"! Thank you again for your great assistance.