Help for this page

Select Code to Download


  1. or download this
    use strict;
    use File::Spec::Functions;
    ...
    my @dirs = qw( ../dir/path1 ../dir/path2 );
    my @canon_dirs = map { canonpath($_) } @dirs;
    print Dumper(\@canon_dirs);
    
  2. or download this
    ../somedir/path
    $VAR1 = [
              '../dir/path1',
              '../dir/path2'
            ];
    
  3. or download this
    ..\somedir\path
    $VAR1 = [
              '..\\dir\\path1',
              '..\\dir\\path2'
            ];
    
  4. or download this
    use strict;
    use File::Spec::Functions;
    ...
    print "$file1\n";
    my $file2 = canonpath("$ROOTDIR/../input/data2.txt");
    print "$file2\n";
    
  5. or download this
    C:\Data\data.txt
    C:\Data\..\input\data2.txt
    
  6. or download this
    /var/data/data.txt
    /var/data/../input/data2.txt