#!/usr/bin/perl use strict; use warnings; use diagnostics; use Cwd; use File::Find; use File::Basename; my $filename = basename($0); my $dirname = getcwd; my %directories = ( '/ftp/pub/www/fantasy' => { link => 'http://www.xecu.net/fantasy', user => 'Fantasy', name => "Fantasy's Realm", }, '/home/lady_aleena/var/www' => { link => 'http://lady_aleena.perlmonk.org', user => 'Lady Aleena', name => "Lady Aleena's Home", }, 'C:/Documents and Settings//My Documents/fantasy' => { link => 'file:///C:/Documents and Settings//My Documents/fantasy', user => '', name => "'s Place", }, ); sub get_rootdir { for my $dir (keys %directories) { return $dir if $dirname =~ /^\Q$dir/; } } my $rootdir = get_rootdir; if (not exists $directories{$rootdir}) { die "You really screwed up." } my $rootlink = $directories{$rootdir}{link}; my $rootuser = $directories{$rootdir}{user}; my $rootname = $directories{$rootdir}{name}; #@ARGV == 1 and -d $ARGV[0] or die "Usage: $0 path_name\n"; #( $rootdir = shift ) =~ s{(?\n", ' ' x $indent ); $indent++; if ( exists( $$href{'./'} )) { printf( "%s
  • %s
  • \n", ' ' x $indent, $_ ) for ( @{$$href{'./'}} ); delete $$href{'./'}; } if ( keys %$href ) { for my $subdir ( sort keys %$href ) { printf( "%s
  • %s\n", ' ' x $indent, $subdir); $indent++; print_tree( $$href{$subdir}, $indent ); $indent--; printf( "%s
  • \n", ' ' x $indent ); } } $indent--; printf( "%s\n", ' ' x $indent ); }