on Wed, 01 May 2002 08:44:28 GMT, Tanton Gibbs wrote:
> I really don't think you want to use hashes here. A hash is a
> one-way association. In other words, I have a person's name and I
> want to look up his address or I have a phone number and I want to
> look up who lives there. What you are asking for is a way to store
> two objects together. One really doesn't identify the other, they
> just both want to live happily together. For this, you should use an
> array reference. Array references are declared by the left and right
> bracket []. So, for the example you gave you would say
> my $aref = [$pdf1, $link1];
>
I beg to differ. Hashes *are* fine for this type of work. An original file
can be associated with its link (to be):
$hash{$file} = $link;
It can be initialized as follows:
my %hash = (
'file1' => 'link1',
'file2' => 'link2',
# ...
'filen' => 'linkn',
);
And then, later on:
while ( my ($file, $link) = each %hash ) {
link $file, $link;
}
BTW, you don't want to use 'exec', because it never returns. You should
use 'system' instead. But then, Perl has its own 'link' function.
See
perldoc -f system
perldoc -f exec
perldoc -f link
--
felix
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]