foreach $i (@dir) {
my @title = split /\./, $dir[$i];
$i is your file name so split that not the @dir entry. You're sort of trying
the same thing twice. foreach gets each array element, one at a time - you're
split usage implies you're expecting the array's index (also the var. name $i so
for
Hi John,
Please, check my comments below:
On Sun, Jun 10, 2012 at 12:23 PM, John M Rathbun wrote:
> Hello and thanks for volunteering your time!
>
> I'm returning to PERL after about a year and am struggling to remaster
> some syntax:
>
> #!/usr/local/bin/perl
> use warnings;
> use strict;
> us
Hi John
Refer to the comments
foreach $i (@dir) {
*#$i here refers to each content of your array @dir, which are file names*
my @title = split /\./, $dir[$i];
*#$i here refers to the array index, which should be number*
$name = $title[0];
print FH "$name\n";
}
Zheng
2012/6/10 John M Rathbun
>
Hello and thanks for volunteering your time!
I'm returning to PERL after about a year and am struggling to remaster
some syntax:
#!/usr/local/bin/perl
use warnings;
use strict;
use diagnostics;
# Converts current directory to a list of links
my @dir;
my $name;
my $i = 0;
opendir DH, "." or