in reply to Recursive sub efficiency

I can't say that it's more efficient, but it's another way of doing it. I found a script by mirod:
#!/usr/bin/perl use strict; my $fileName = 'Documents and Settings/My Documents/TEST'; create_dirs( $fileName); open (List, '>', $fileName); sub create_dirs { my $filename= shift; my $dir; while( $filename=~ m{(/?[^/]+)(?=/)}g) { $dir .= $1; next if( -d $dir); mkdir( $dir) or die "cannot create $dir: $!"; } }

Replies are listed 'Best First'.
Re^2: Recursive sub efficiency
by Anonymous Monk on Jun 11, 2010 at 19:56 UTC
    Thats cool, same thing as what I did just in less lines I like it. Can we use even fewer lines of code (not withstanding the 1 liner system call to xcopy)