theroninwins has asked for the wisdom of the Perl Monks concerning the following question:
Those file names are stored in an array that is then used for some stuff likec:\folder1\folder2\my_file_name.com c:\folder\filename.bat
this is just part of the code.... but here it comes:foreach $file (@file_list) { # Nacheinander Öffnen der Dateien die Ü +berprüft werden sollen print "$file\n"; my $comment = 0; open(IN,"$file") || print "Can't open $file!\n\n"; push (@include_temp, $file); while (<IN>) { ###Auskommentierte Zeilen überspringen### if (/\%\{.*/){ if(/^@([A-Z][^T][^W][^(]+)\s*\(/i){ # Suche nach Funktionen + vor einem Kommentar in der gleichen Zeile $function = $1; $function =~ s/\s+$//; push(@function_temp, $function); $comment =1; next; }else { $comment =1; } }
I thought of just choping away everything from the last \ onwards but don't really know how to .c:\folder1\filename.doc should only be filename.doc
foreach $file (@file_list) { (my $volume,my $directories, my $filename) = File::Spec->splitpath( +$file ); print "$filename\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Get last occurence of a character in a string
by Corion (Patriarch) on Aug 06, 2008 at 12:43 UTC | |
|
Re: Get last occurence of a character in a string
by Fletch (Bishop) on Aug 06, 2008 at 12:43 UTC | |
|
Re: Get last occurence of a character in a string
by FunkyMonk (Bishop) on Aug 06, 2008 at 12:48 UTC | |
by pjotrik (Friar) on Aug 06, 2008 at 13:16 UTC | |
by FunkyMonk (Bishop) on Aug 06, 2008 at 13:23 UTC | |
|
Re: Get last occurence of a character in a string
by JadeNB (Chaplain) on Aug 06, 2008 at 19:32 UTC |