I can't figure out how you got that speed improvement. The
time you save by removing the /i flag is lost when you
build a large array in memory (45,000 words in my
machine).
Besides, do you really think an
all-uppercase output is better?
$ time perl wsearch.pl owijfwapplelaskfiwejfcherryalkfwiofwfblossomowiejf
1 Al
2 apple
3 as
4 ask
5 blossom
6 cherry
7 err
8 he
9 her
10 Herr
11 Io
12 Los
13 loss
14 mow
15 of
16 so
17 we
0.30user 0.00system 0:00.30elapsed 99%CPU
$ time perl wsearch2.pl owijfwapplelaskfiwejfcherryalkfwiofwfblossomowiejf
1 AL
2 APPLE
3 AS
4 ASK
5 BLOSSOM
6 CHERRY
7 ERR
8 HE
9 HER
10 HERR
11 IO
12 LOS
13 LOSS
14 MOW
15 OF
16 SO
17 WE
0.48user 0.00system 0:00.48elapsed 99%CPU
Of course, I ran both scripts at least 4 times, to make sure that
the storable file was created and that both scripts were reading their
input from the disk cache.