one key hash

Eugene Tsyrklevich eugenet at
Fri Feb 25 00:35:54 CST 2000


man perlre
perldoc perlre

for regular expressions discussion.
check out 'mastering regular expression' book for even more info.. it's kinda outdated but still covers a lot of ground

you might also wanna bookmark


On Fri, 25 Feb 2000 12:14:22   C. Abney wrote:
>On Thu, 24 Feb 2000, Bob Forgey wrote:
>> ... I would probably use
>>         keys(%foo_h)[0]
>> instead of the `each %foo_h', just to be explicit.
>I tried that and couldn't get it to work.  Made sense to me too, otherwise.
>It's a bit wordier than mine, but tells you exactly what you want to do.
>I even tried it with a symref... :(
>> I presume you're using `tar tvf ...', which is the reason for the map
>> function, instead of a chomp?
>Yes, and that it'll also work with (for example) long file listings, or
>ftp->ls(), or...
>my root dir test was really messed up, though.  Here's a mod on the 
>script (and in usable form!)
>#! /usr/bin/perl
># Takes output from a tarball manifest listing and checks that only one
># toplevel directory/file exists.
># just do a 'tar tvfz bar.tar.gz |'
>@flist = map +(split)[-1], <>;
># Danger: tar Pczf bar.tar.gz meme proxy /vmlinuz
># this grabs the topmost directory/file name(s) from the tar manifest
>for (@flist) { $foo_h{$1}++ if m|([^/]+)|; $augh++ if m|^/|; };
>die "someone's out to get you\n" if ( $augh );
>die "more than one topmost directory or file\n" if ( keys (%foo_h) != 1 );
>$top = each (%foo_h);
>print "topmost directory: $top\n";
>Thanks for the tips...

MailCity. Secure Email Anywhere, Anytime!

The posting address is: san-diego-pm-list at

List requests should be sent to: majordomo at

If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at> with the following
command in the body of your email message:

    unsubscribe san-diego-pm-list

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at> .
This is the general rule for most mailing lists when you need
to contact a human.

More information about the San-Diego-pm mailing list