John W. Krahn wrote:
Gunnar Hjalmarsson wrote:
Here the loop is finished, but nothing is returned from the
subroutine.
return @basenames;
Actually, something IS returned, it is just not something that the OP
expects or wants.
Yeah, I suppose it returns the null-string. Thanks for the correction.
--
Ron Smith wrote:
Here's the problem:
My input looks like the following:
C:\Perl\scripts\shots\sp2\shot_1\dir.txt
C:\Perl\scripts\shots\sp2\shot_1\drames.txt
C:\Perl\scripts\shots\sp2\shot_1\filename.0001.cin
[snip]
C:\Perl\scripts\shots\sp2\shot_1\sub_directory\basename.0008.rgb
C:\Perl\scripts\sho
Gunnar Hjalmarsson wrote:
Ron Smith wrote:
my @basenames = &basenames(@paths);
sub basenames {
foreach (@_) {
if ($_ =~ /(\w+)\.\d+\.\w+$/) {
@basenames = $1; # print "@basenames\n";
That line assigns to @basenames the extracted basename from the last
path only,
On Wed, 2004-10-20 at 23:19, Ron Smith wrote:
> The following is the code:
> #!/usr/bin/perl -w
> use strict;
> my @paths = `dir /b/s`; # print
> @paths;
> my @basenames = &basenames(@paths);
> sub basenames {
> foreach (@_) {
> if ($_ =~ /(\w+)\.\d+\.\w+$/) {
>
Ron Smith wrote:
#!/usr/bin/perl -w
use strict;
my @paths = `dir /b/s`; # print @paths;
my @basenames = &basenames(@paths);
sub basenames {
foreach (@_) {
if ($_ =~ /(\w+)\.\d+\.\w+$/) {
@basenames = $1; # print "@basenames\n";
That line assigns