I've made a small program that tries to get all the files from a directory that's full of files that they have the name format : pepe-1_DDMMYYYY.txt or pepe-2_DDMMYYYY.txt.
First, I am just trying to get them and print the array created. Afterwards, when this works I'll do more things with the data in them included, but for now I can't get though with the first objective :-/
When I execute the program it makes NOTHING!!! At least, that's what it seems...
I know its not a very good code, but it's my first one! :-D
Can anybody give some advice about where's the bug?
Thanks in advance.


#!perl
use strict;
use warnings;
my $program;
my @filenames;
opendir (FITXER,"c:/documents and settings/administrador/escritorio/pepes") or
> die "no es pot llegir el directori: $!\n";
@noms = readdir (FITXER) or die "no es poden agafar els noms dels fitxers \n";
  foreach $program (@noms)
    {
    if ($program =~ m/^pepe-1_(\d[8])\.txt$/)
        {
        ### do stuff, given a filename
          print "$program \n";
        }
    elsif( $program =~ m/^pepe-2_(\d[8])\.txt$/)
        {
        ### do stuff, given a filename
        print $program <stdout>;
        }
    };


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to