#!/usr/bin/perl use strict; use warnings; my @set = qw(one bright day in the middle of the night); my %pos; # Preprocess @set { no warnings 'uninitialized'; vec( $pos{ ord( $set[ $_ ] ) }, $_, 1 ) = 1 for 0 .. $#set; } while ( my $val = <DATA> ) { chomp $val; my $bitstr = $pos{ ord( $val ) } or next; my $i = length( $bitstr ) * 8 - 1; while ( $i-- ) { print "$val\n" and last if vec($bitstr, $i, 1) && $val eq $set +[ $i ]; } } __DATA__ one two buckle my shoe the cat in the hat
Cheers - L~R
In reply to Re^2: Looking for function similer to member() in SKILL
by Limbic~Region
in thread Looking for function similer to member() in SKILL
by riz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |