Help for this page

Select Code to Download


  1. or download this
    my $foo = "A string to work on.";
    my @substrs = map {\substr $foo, $_} 0 .. length($foo) - 1;
    my @sorted = sort { $$a cmp $$b } @substrs;
    
  2. or download this
    $ perl -e '$foo = "A short string\n"; $bar = \substr $foo, 0, 1; $$bar
    + = "The"; print $foo'
    The short string
    $