some terrible problems with glob

Ask a Question related to PERL Miscellaneous, Design and Development.

  1. #1

    Default some terrible problems with glob


    Hello guys,some things in my code are happening,which I don't
    understand.I am trying to open different directories and to load a
    bunch of files.But this don't work.
    It is all fine,when I am working in my home directoy.But if I change
    it the glob-function don't work.

    Here is the code:

    #!/usr/local/bin/perl -w

    print "\nHi please tell me your directory!\n";
    chomp ($directory = <STDIN>);
    print "\nOK now tell me the glob name!\n";
    chomp ($opname = <STDIN>);
    print "\nWorking ... \n";
    ###########################


    if (!opendir VH,$directory)
    {
    print "\nThe directory $directory was not found !!\n";
    return;}

    print "\nEnter 2 \n";

    $MJJ=-1;
    foreach $datei (readdir VH){
    $MJJ=$MJJ+1;
    $files[$MJJ]=$datei;
    print "$files[$MJJ]\n";
    }

    print "\n@files \n";

    @files=glob "*$opname*";

    print "\n$opname \n";

    print "\nEnter 3 \n";

    print "\n@files \n";


    Zoran Guest

  2. Similar Questions and Discussions

    1. #38022 [Com]: glob() problems
      ID: 38022 Comment by: francois at tekwire dot net Reported By: flconseil at yahoo dot fr Status: Open Bug...
    2. My graphics look terrible!!
      I'm creating an 8 page brochure and when I import my beautiful jpeg pictures scanned thru Photoshop-they look horrible. My process is >File>Place>and...
    3. I made a terrible mistake...
      Hi there, I am desperate to unpublish my first attempt at using Contribute. Instead of taking the time to read through the manual, I thought I...
    4. Why does Photoshop CS have terrible screen redraw??
      Christopher, Yes Painter is terrible on screen re-draws. I have used Painter since version 3 on windows and Painter ran bad then too; the problem...
    5. variable file glob into grep without glob()
      Hope I don't get shot for posting again, but I really need help with this ... I want to process lots (thousands) of files. I want to take a file...
  3. #2

    Default Re: some terrible problems with glob

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Zoran <zoran@iehk.rwth-aachen.de> wrote in
    news:fh8lgv4b8m8n9qj57kgd70f4kmk3attbnf@4ax.com:
    >
    > Hello guys,some things in my code are happening,which I don't
    > understand.I am trying to open different directories and to load a
    > bunch of files.But this don't work.
    > It is all fine,when I am working in my home directoy.But if I change
    > it the glob-function don't work.
    >
    > Here is the code:
    ....
    > $MJJ=-1;
    > foreach $datei (readdir VH){
    > $MJJ=$MJJ+1;
    > $files[$MJJ]=$datei;
    > print "$files[$MJJ]\n";
    > }
    FYI, this whole loop is unnecessary. You could just do:

    @files = readdir VH;

    > print "\n@files \n";
    >
    > @files=glob "*$opname*";
    This glob happens in the current directory, not in $directory.
    Perhaps you should do

    chdir $directory;

    first.

    - --
    Eric
    $_ = reverse sort qw p ekca lre Js reh ts
    p, $/.r, map $_.$", qw e p h tona e; print

    -----BEGIN PGP SIGNATURE-----
    Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

    iQA/AwUBPwqxgmPeouIeTNHoEQLTnwCbBwVDuKCuUZ4FCYWguGm19j 9aEvIAoJ2n
    4092UqAWX+H3TZuyeDPi8zxn
    =HDT4
    -----END PGP SIGNATURE-----
    Eric J. Roode Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139