This (code below) makes sense to me, but I was talking this over with a
co-worker on Friday, and then I tried putting together some 2-dimensional
hashes - which hurts my head at the moment. So I went to
perl.plover.com/FAQs to read (again) his article on references, and I still
have a mental block. Conceptually I understand multi-dimensioned hashes, but
in practice I have a LOT of trouble with the syntax.
I need to work hard to solidify how to put it together in a real coded
situation.
OTH, This code posted below makes more sense to my brain. I was on this
track earlier, but digressed into the above approach - which is probably more
elegant, but difficult for me to see how to do in practice.
deb
R. Joseph Newton <[EMAIL PROTECTED]> had this to say,
> Deb wrote:
>
> > Hi Guys,
> >
> > I have an array in which each element is a line commandline data. It looks
> > something like this -
> >
> > @Array contains lines:
> >
> > post1: -r [EMAIL PROTECTED] -x cat-100 -h post1
> > post2: -x tel -h post2
> > post3: -h post3 -x hifi
>
> The getRelationships sub here has a few less typos, and the test stub runs well.
>
> #!/usr/bin/perl -w
>
> use strict;
> use warnings;
>
> sub getRelationship($$);
>
> testGetRelationships();
>
> sub testGetRelationships {
> my $string = "post1: -r [EMAIL PROTECTED] -x cat-100 -h post1";
> my %relationships;
>
> getRelationship($string, \%relationships);
>
> foreach my $key (keys %relationships) {
> print "$key:=$relationships{$key}\n";
> }
> }
>
> sub getRelationship ($$) {
> my ($commandline, $relationships) = @_;
> # print "$commandline\n"; #debug
> my @commands = split /\s+-/, $commandline;
> my $key = shift(@commands);
> foreach (@commands) {
> if (s/^x\s+//) {$$relationships{$key} = $_;}
> }
> }
>
>
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
There are 010 types of people in the world:
those who understand binary, and those who don't.
��� 111,111,111 x 111,111,111 = 12,345,678,987,654,321 (decimal)
~
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]