#!/usr/bin/perl $ARGV[0] eq "-a" && shift(@ARGV) && $h++; $ARGV[0] eq "-h" && exec("perldoc", "el"); opendir(D, "."); @l = grep {-f && ($h || !/^\./) } readdir(D); for $a ( @ARGV ) { @l = grep(/$a/,@l); } if( @l > 1 ) { print "[".++$i."] $_\n" for @l; chop($c=); if( 0 < $c && $c <= @l ) { exec("$ENV{'EDITOR'}", "$l[$c-1]"); } elsif( $c ) { exec("$ENV{'EDITOR'}", "$c"); } } elsif( @l == 1 ) { exec("$ENV{'EDITOR'}", "$l[0]"); } __END__ =head1 NAME el - mnemonic wrapper for $EDITOR =head1 SYNOPSIS el [-a] [regex1 regex2 ...] -a - include hidden files =head1 USE Find files in current directory that match all arguments. If a single match, open the file in $EDITOR. If multiple matches, display a list and request a numerical selection. If the response is not blank and not in the list consider it a filename to open.