Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
My Goal is to push the following into an array.For some reason when I print the data in the array,nothing is getting printed.Can anyone advise what should I change in the below code to make it happen?
1.All files with .lib/.lib.*(with .lib,.lib.1,.lib.2... ) extension 2.Files with name serport,serport_d
#!/usr/bin/perl -w use strict; use warnings; use File::Find; use Getopt::Long; my %options=(); my @libs; my %seen; #getopt("b",\%options); GetOptions (\%options, 'data=s') or die("\nERROR:Invalid Option\n"); find(sub { push @libs, "$_\n" if -f && /\.lib$ && serport && serport_d/ && + !$seen{$_}++; }, "$options{data}"); for my $file (@libs) { print "\n$file"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Data not getting stored in an array
by wind (Priest) on Apr 24, 2011 at 22:51 UTC | |
by Anonymous Monk on Apr 24, 2011 at 23:00 UTC | |
by wind (Priest) on Apr 24, 2011 at 23:36 UTC |