Skip to content

Instantly share code, notes, and snippets.

@bokutin
Created April 24, 2012 20:50
Show Gist options
  • Save bokutin/2483600 to your computer and use it in GitHub Desktop.
Save bokutin/2483600 to your computer and use it in GitHub Desktop.
use utf8;
use File::Spec;
use Win32::Unicode;
# フルパス = フォルダ名 + ファイル名
my $path = File::Spec->catfile("c:/Documents and Settings", "萌え♥.txt");
sayW $path; # C:\Documents and Settings\萌え♥.txt
# ファイルを作成してみる
my $file = Win32::Unicode::File->new(">", $path);
$file->print("Hello");
$file->close;
# フルパスを分解してみる
{
my ($volume,$directories,$file) = File::Spec->splitpath($path);
sayW $volume; # C:
sayW $directories; # \Documents and Settings\
sayW $file; # 萌え♥.txt
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment