Help for this page

Select Code to Download


  1. or download this
    C:\parrot>p1
    [0] Perl> $var1 = '1.1.2'; $var2 = '1.1'; 
    ...
    if( index( $var2, $var1 ) == 0 ) { print "matches" } 
    else { print "Doesn't match" };;
    Doesn't match
    
  2. or download this
    $var2='1.11.2';
    $var1='1.1';
    
  3. or download this
    [0] Perl> $var1 = '1.11.2'; $var2 = '1.1'; 
    if( index( $var1, "$var2." ) == 0 ) { print "matches" } 
    else { print "Doesn't match" };;
    Doesn't match