in reply to Some problem pattern matching
for ($a=0; $a<= scalar(@abst_listing); $a++){
to:
for ($a=0; $a< scalar(@abst_listing); $a++){
A more Perl-ish way to create this for loop is as follows:
for my $a (0 .. $#abst_listing){
Notice that I declared the loop variable in the for statement itself. You should do the same for your b and c loops as well.
If you had shown some actual data, it would be easier to figure out why you are not getting the matches you expect. Perhaps some other tips in the Basic debugging checklist will help you. If your arrays contain metacharacters, perhaps you need to use quotemeta for your regular expressions. You could try to chomp your arrays, then simplify your regexes by removing the //m modifiers.
As a side note, your get_data sub is very similar to File::Slurp::read_file.
I don't think that does what you want. lib "is typically used to add extra directories to perl's search path", but you are trying to specify a module file. Perhaps this is what you meant:use lib'/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/DBD/mys +ql.pm';
use lib '/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi';
Update: fixed typo (thanks amedico).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Some problem pattern matching
by amedico (Sexton) on Apr 03, 2010 at 05:44 UTC | |
|
Re^2: Some problem pattern matching
by amedico (Sexton) on Apr 03, 2010 at 05:36 UTC | |
|
Re^2: Some problem pattern matching
by eMBR_chi (Acolyte) on Apr 07, 2010 at 15:07 UTC |