Help for this page

Select Code to Download


  1. or download this
    use File::Spec::Functions qw(canonpath splitdir);
    
    ...
    # @path now contains ('', 'home', 'a', 'ff.pl')
    
    print $path[2], "\n";
    
  2. or download this
    my ($userhome) = ($path =~ m!^/home/([^/]+)!);
    
  3. or download this
    my @path = split m!/!, $path;
    # @path is now ('', 'home', 'a', 'ff.pl')
    
    print $path[2], "\n";