Help for this page

Select Code to Download


  1. or download this
      DB<137> %lexicon=("day"=>1,"night"=>2,"knight"=>3)
     => ("day", 1, "night", 2, "knight", 3)
    ...
    
      DB<141>  @lexicon{@matches}
     => (1, 3, 2)
    
  2. or download this
      DB<146> $pattern = join "|", map { "\\b$_\\b" } sort {length($b)<=>l
    +ength( $a) } keys %lexicon
     => "\\bknight\\b|\\bnight\\b|\\bday\\b"
    
      DB<147> @matches =  ( $tweet =~ /($pattern)/g )
     => ("knight", "night")