Deb wrote:
>
> John wrote:
> > Did you try the code I posted Friday? (Message-ID: <[EMAIL PROTECTED]>)
>
> Thanks, yes, I did. But, the syntax was new to me, and I've been reading
> up on it. I couldn't really get it to do what I want (see my previous
> post to this one). But, that's probably b/c I didn't explain very
> well. I hope I explained more completely in my posting just previous
> to this one.
Ok, here it is using the code you posted elsethread.
#!/bin/perl
use warnings;
use strict;
use constant DEBUG => 1;
my %newHash;
while ( <DATA> ) {
my %cmdLine = /(-[a-z])\s*((?!-)\S*)/g;
# Build out the data structure
$newHash{$cmdLine{-x}} = \%cmdLine;
}
for my $masterKey ( sort keys %newHash ) {
print "$masterKey\n";
for my $opt ( sort keys %{$newHash{$masterKey}} ) {
print "\t$opt\t" . $newHash{$masterKey}{$opt} . "\n";
}
}
__DATA__
ten-me-900: -r timbu -x me-900 -h ten-me-900
hidit: -r tenbu -x networks-users -h hidit
postal: -x direct -h postal
pickit: -h pickit -x uncrp -r oakd
After running it I get this output:
direct
-h postal
-x direct
me-900
-h ten-me-900
-m e-900:
-r timbu
-x me-900
networks-users
-h hidit
-r tenbu
-x networks-users
uncrp
-h pickit
-r oakd
-x uncrp
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]