Mel Awaisi wrote:
> Hi
>
> My error is as the subject says, i have a script that i am trying in it to
> locate where a directory with images are.
>
> the part in the script that the error i think is arising from is
>
> my $dir = '/home/me/images/';
> my @jpegs = `ls *.jpg`;
> foreach (@jpegs) {
> print"$_"; # dont forget that a newline is still at the end of each
> element in the array...
> }
>
> ------------------------
> ls: *.jpg: No such file or directory
> -----------------------
>
chdir '/home/me/images/' or die "Unable to chdir to /home/me/images: $!";
my @jpegs = glob "*.jpg";
print "$_\n" for @jpegs;