Help for this page

Select Code to Download


  1. or download this
    my @teststr;
    my %testhash;
    ...
    $teststr[0] = "32977186    4 -rw-r--r--   1 owner   mygrp   65 Aug  4 
    +13:16 /long/path/to/my/file/file1.txt";
    $teststr[1] = "32977186    4 -rw-r--r--   1 owner   mygrp   65 Aug  4 
    +13:16 /long/path/to/my/file/file2.txt";
    
  2. or download this
    file1=>file1.txt
    file2=>file2.txt
    
  3. or download this
    foreach my $line (@teststr)
     { my ($key, $val);
    ...
       ($key = $val)  =~ s/\.txt//;
         $testhash{$key} = $val;
    }
    
  4. or download this
    my %testhash = map  {(my $val = (split /\//, $_)[-1]); ((my $key = $va
    +l)  =~ s/\.txt//);} @teststr;
    
  5. or download this
    1 => 1