Thread RegEx, backslash im Pfad (61 answers)
Opened by PETER_PAN2009 at 2010-04-14 15:24

pq
 2010-04-14 15:30
#136010 #136010
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
falls du unter unix arbeitest und einen windows-pfad hast:
Code (perl): (dl )
1
2
3
4
use File::Spec::Win32;
my $path = q{ABCDEF\AB1010\datei.txt};
print $path;
my $file = (File::Spec::Win32->splitpath($path))[-1];


falls du unter windows arbeitest:
Code (perl): (dl )
1
2
3
4
use File::Spec;
my $path = q{ABCDEF\AB1010\datei.txt};
print $path;
my $file = (File::Spec->splitpath($path))[-1];


edit: [-1] hinzugefügt, da der skalare kontext anscheinend nicht dokumentiert ist (bei mir liefert der zumindest die datei)
Last edited: 2010-04-14 15:32:10 +0200 (CEST)
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread RegEx, backslash im Pfad