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
>
> What I really need to do is build a relationship between the first field
> (which is the same as the argument to -h) and the argument to -x.  The -x flag
> can be dropped, as they're not needed.

Hi Deb,

Is this something like what you are looking for?

sub getRelationship($, $) {
  my ($commandline, $relationships) = @_
  my @commands = split /\s -/, $commandline = @_;
  my $key = shift(@commands);
  foreach (@commands) {
    if (/^x/) {
      s/^x\s+//;
      $$relationships{$key} = $commandline;
    }
  }
}

This should put a string containing all parameter to any -x command into the hash 
referenced by $relationships.

[snip]

>           There are 010 types of people in the world:
>        those who understand binary, and those who don't.    --agreed so far
> τΏτ   111,111,111 x 111,111,111 = 12,345,678,987,654,321 (decimal)

It mgght be interesting also to show how you can just LOOK at a number like 
2,305,843,008,159,952,128 and know that it has about about a one-in-four chance of 
being one of the eight "perfect numbers" found within the range from zero to that 
number.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to