one key hash

C. Abney cabney at
Thu Feb 24 14:23:01 CST 2000

I'm wondering if anyone can come up with a nicer way to get this key.
Or even dump the hash altogether.  I'm using:

	$top = each (%foo_h);

By nicer I guess I mean more direct.  I find this misleading.

It's a part of the same script, in which I'm checking the manifest of
a tarball for what are (to my mind) unexpected features.  Obviously I'm
automating an install (shhh!) of some software, and want to make sure
nothing tooo out of the ordinary is happening while I'm not looking.

It's a part of this code sequence:


	@flist = map +(split)[-1], @tarout;
	log_n_die ( "Unpack from rootdir, Huh?" ) if ( $flist[0] =~ /^\// );

	# this grabs the topmost directory/file name(s) from the tar manifest
	for (@flist) { $foo_h{$1}++ if /([^\/]+)/; };

	log_n_die ( "No top-level directory!!!" ) if ( keys (%foo_h) != 1);

	$top = each (%foo_h);

	... # more checks, unpacking stuff

	log_n_die ( "Couldn't find PBS source dir, $top" ) unless ( -d $top );

	... # and so on...

I'd also appreciate a lecture on regular expressions...<g>  One of the
biggest gripes I hear about Perl is its obscure syntax and resulting
poor maintainability.  I KNOW that's wrong!  I don't want to contribute
to that perception and therefore welcome any hints (but I'm off topic
now, and it's my own post, so... )

Perhaps you've noticed this is very closely related to what I posted
last time!  I'm really not a slow coder, honest. Really. Weell, I have
a lot of other things that get in the way. Or something. Oh, this is
the next revision! Yeah, that's it.

Anyway, anyone have a better way to do this?

p.s. Sorry I missed the meeting.  How'd it go?

Mighty Mouse is a cartoon. Superman is a real guy. No way a cartoon
could beat up a real guy! -- Teddy                         C. Abney


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