in reply to populate a hash, with limits set by user?

If it's a homework assignment, why not impress your teacher? Here's something to get you extra credit:
#!/usr/bin/perl -w use strict; print "Limit? "; my %input = map { print "Key = Value: "; split(/=/, <STDIN>); } (1 .. +(<STDIN>)); print %input, "\n";
Guaranteed to impress old LISP hackers.

Replies are listed 'Best First'.
RE: Re: populate a hash, with limits set by user?
by BastardOperator (Monk) on Sep 12, 2000 at 16:38 UTC
    you make my brain hurt ;).
RE: Re: populate a hash, with limits set by user?
by Adam (Vicar) on Sep 12, 2000 at 20:58 UTC
    Slick. I like it. Maybe the regex should handle optional space around the =
    use strict; # Of course! print "Limit? "; my %input = map { print "Key = Value: "; split /\s*=\s*/, <STDIN> } ( +1 .. (<STDIN>) ); use Data::Dumper; # Pretty print 8^) print Data::Dumper->Dump([\%input], ["input"]), "\n";