Help for this page

Select Code to Download


  1. or download this
    $x = 'abc' =~ /a(.)c/;         # 1 (or false on fail)
    @x = 'abc' =~ /a(.)c/;         # b (or () on fail)
    $x = ( 'abc' =~ /a(.)c/ )[0];  # b (or undef on fail)
    
  2. or download this
    $x = 'abc' =~ /a(.)c/ && $1;   # b (or false on fail)