Help for this page

Select Code to Download


  1. or download this
    my( $first_char, $rest)= (substr( $string, 0, 1), substr( $string, 1))
    +; 
    my( $last_char, $rest)= (substr( $string, -1), substr( $string, 0, -1)
    +);
    
  2. or download this
    my @char= split //, $string;
    my $first_char= shift @char;
    my $rest= join "", @char;
    my @char= split //, $string;
    my $last_char= pop @char;
    my $rest= join "", @char;