Help for this page

Select Code to Download


  1. or download this
    perl -E 'our @array = (1,2,3); *1=\@array; say for @1;'
    1
    2
    3
    
  2. or download this
    # $1 will be undef, so not relevant to the pattern. [0] will be a sing
    +le-character character class, so matches "0".
    perl -E 'our @array = (1,2,3); *1=\@array; say for @1; say "yes" if "0
    +" =~ m/.?${1}[0]/;'
    ...
    2
    3
    yes
    
  3. or download this
    # $1[0] is seen as interpolation, placing the value of "1" into the re
    +gexp, which matches with the "1" in our target string.
    perl -E 'our @array = (1,2,3); *1=\@array; say for @1; say "yes" if "1
    +" =~ m/.?$1[0]/;'
    ...
    2
    3
    yes