in reply to Re: Searching for two lines that begin with the same string
in thread Searching for two lines that begin with the same string

You don't have to make sure of having an array ref. for a particular key, your code $route{$key} ||= [];, as doing the push @{$route{$key}}, $line; will push onto an auto-vivified array ref. if one doesn't exist or push onto the existing ref. otherwise.

Cheers,

JohnGG

Replies are listed 'Best First'.
Re^3: Searching for two lines that begin with the same string
by jbert (Priest) on Dec 18, 2006 at 17:20 UTC
    Thanks very much. I didn't know that push would auto-vivify in that way. That's going to reduce my line count a bit more in the future.