in reply to help needed in opendir

Hmmm sounds like homework?

I would suggest you read up on opendir and take a look at utf8 on cpan.

-edit- But for the sake of fun; you could experiment with *not tested*

#! /usr/bin/perl use strict; use warnings; use bytes; opendir DIR, "/path/to/dir" or die "opendir: $!"; my @files = readdir DIR; open HANDLE, ">filelist" or die "open filelist: $!"; foreach (@files) { print HANDLE "$_\n"; }

Get it working and then use the use utf8; and compare the results.

Replies are listed 'Best First'.
Re^2: help needed in opendir
by uva (Sexton) on Mar 13, 2006 at 07:18 UTC
    i actually created directory with chinese characters , i tried to read that chinese directory. and also i tried the above solution it is just printing "???" for that chinese directory . how to read that chinese directory.
      Works for me.
      ~/536198> ls 536198.pl 中文 ~/536198> cat 536198.pl #!/usr/bin/perl use strict; use diagnostics; opendir my $dirhandle, "." or die "could not opendir current dir: $!"; print join "\n", readdir $dirhandle; closedir $dirhandle; ~/536198> perl 536198.pl . .. 中文 536198.pl
        i am using windows 2000 .