Next | Welcome to my ~/bin | 56 |
# Return contents of context file as hash sub context { my $cf = context_file(); local *CF; open CF, "<", $cf or croak "Couldn't open context file '$cf': $!; aborting"; my %c; while (<CF>) { chomp; my ($k, $v) = split /:\s*/, $_, 2; $c{$k} = $v; } wantarray ? %c : \%c; }
OK, I suppose that's not too bad either.
But wait, where is context_file() coming from?
Next | Menu | Copyright © 2005 M. J. Dominus |