Thanks to everyone for the help and replies.
However I am not sure what the problem is but even though $FN_SPLIT and $FOUND_FILE match they do not produce the correct results. Here is the code that I am using along with the results of running it. I am not sure why even though both variables match($FN_SPLIT and $FOUDN_FILE) they do not produce a print of MATCH MATCH as seen the the third entry under results.
If I manually replace $FN_SPLIT in this line ( $FOUND_FILE =~ /($FN_SPLIT)/ ) with a file name, lets say the same one shown below then I get MATCH MATCH MATCH line to print, but again not sure why when the variable is passed it does not produce a match.
Thanks for the help in advance once again.
@FN = split(/\=/, $LINE);
push(@FILE_NAME, @FN[1]);
foreach my $FN_SPLIT (@FILE_NAME) {
chomp $FN_SPLIT;
print "This is the fn_split variabl
+e: $FN_SPLIT\n\n";
find (
sub {
my $FOUND_FILE = $_;
chomp $FOUND_FILE;
print "This is the FOUND_
+FILE variable: $FOUND_FILE\n\n";
if ( $FOUND_FILE =~ /($FN
+_SPLIT)/ ) {
print "==============
+==================================================\n";
print "MATCH MATCH MA
+TCH $FN_SPLIT : $FOUND_FILE MATCH MATCH MATCH\n";
print "==============
+==================================================\n";
}
else {
print "$FOUND_FILE do
+es not equal: $FN_SPLIT\n\n";
}
},
$SEARCH_DIR
);
}
Results
This is the fn_split variable: 08ptr00
This is the FOUND_FILE varible: .
. does not equal: 08ptr00
This is the fn_split variable: 08r2t00
This is the FOUND_FILE varible: 08r3t00
08r3t00 does not equal: 08ptr00
This is the fn_split variable: 08ptr00
This is the FOUND_FILE varible: 08ptr00
08ptr00 does not equal: 08ptr00
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.