in reply to Daft Regexp

Perhaps the first character in your string isn't a letter. As apparently it's supposed to be a directory path, it likely isn't.

Replies are listed 'Best First'.
Re: Re: Daft Regexp
by fourmi (Scribe) on Aug 05, 2003 at 04:43 UTC
    Yup that's it
    i was regexping the path with file, not the file then adding on the path so
    my ($newname) =$handle."\\".$entries[$i]; $newname =~ s/^([a-z])/\u$1/g; rename ($handle."\\".$entries[$i], $newname);

    becomes
    my ($newname) =$entries[$i]; $newname =~ s/^([a-z])/\u$1/g; rename ($handle."\\".$entries[$i], $handle."\\".$newname);

    cheers for that, it's always simple things that mess up the most!
      What about what Cody Pendant carefully hinted at?
      my $newname = ucfirst $entries[$i]; rename ($handle."\\".$entries[$i], $handle."\\".$newname);

      Makeshifts last the longest.

        erm i had a look in the o'reily book, and didn't see a reference to ucfirst, and becuase i'm doing a couple of other substitutions too, prefered to find why my effort didn't work, byt the looks of it, his code work wook too though! but would have had the samne stumbling block as mine ended up having..
        cheers
        ant
Re: Re: Daft Regexp
by aquarium (Curate) on Aug 05, 2003 at 02:01 UTC
    not sure which machine you're using...on unix boxen at least, if posix isn't setup properly on the box, then perl can realy balk at char conversions on e.g. unicode or mixed char set strings. why not print all the file/dir names to a file for inspection with a good ascii editor that shows you special chars etc, eg vi.