G'day Mike,

Welcome to the monastery.

In what way does '-f' "not work any more"?

Please provide more information on "I cannot copy or move $scandir."/".$files[0]". How are attempting to copy and move? What's happening? What errors, warnings or other feedback are you getting?

Are you asking Perl to point out problems to you (e.g. strict, warnings, autodie, etc.)? The documentation shows opendir reporting problems in "$!": you're using "$@".

You're using package global variables exclusively (in the code you've shown): this could be causing any number of problems. Without seeing all of your code, it's impossible to tell. Use lexical variables and avoid the issue altogether.

I created this directory (some characters may not render in your browser but the filenames indicate the code points):

$ ls -al pm_1080490_utf8_readdir
total 0
drwxr-xr-x    5 ken  staff    170  1 Apr 21:01 .
drwxr-xr-x  599 ken  staff  20366  1 Apr 21:02 ..
-rw-r--r--    1 ken  staff      0  1 Apr 20:47 Fehler für Projekt x.txt
-rw-r--r--    1 ken  staff      0  1 Apr 20:58 ᚠᚡᚢᚣᚤᚥᚦ (U+16a0 to U+16a6)
-rw-r--r--    1 ken  staff      0  1 Apr 21:01 🜁 🜂 🜃 🜄 (U+01f701 to U+01f704)

I ran this script:

#!/usr/bin/env perl -l use strict; use warnings; use autodie; my $scandir = './pm_1080490_utf8_readdir'; opendir(my $dh, $scandir); my @files = grep { -f "$scandir/$_" } readdir $dh; print for @files;

And got this output:

Fehler für Projekt x.txt
ᚠᚡᚢᚣᚤᚥᚦ (U+16a0 to U+16a6)
🜁 🜂 🜃 🜄 (U+01f701 to U+01f704)

So, I'm unable to reproduce your problem.

Try running exactly the same code as I did (except with a different value for $scandir) and report the result. Show the full output of any errors, warnings, or other messages: vague references to "does not work" and the like are of no use at all. The guidelines in "How do I post a question effectively?" explain what information is useful and how to present it.

-- Ken


In reply to Re: treat files with umlauts (utf) by kcott
in thread treat files with umlauts (utf) by mike.scharnow

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.