All pastes #40910 Raw Edit

Stuff

public text v1 · immutable
#40910 ·published 2006-02-09 21:18 UTC
rendered paste body
#!/usr/bin/perl
sub basedir {
        my $dir;
        my $dirArr;
        my $rtn;

        my $dir = shift;
        @dirArr = split(/\//,$dir);
        pop @dirArr;
        for ($x=0; $x < @dirArr; $x++) {
                if ($dirArr[$x]) {
                        $rtn .= "/".@dirArr[$x];
                }
        }
        return $rtn;
}
print "\n";
print "\n";
print basedir($0);
print "\n";
print basedir($0);
print "\n";