You should probably take a look at 'do'. If you 'do' another perl program
it will get the callers @ARGV, so if you set this up appropriately you
should be good. I ran a quick benchmark on the two, here's what I got.
Benchmark: timing 1000 iterations of do, system...
do: 3 wallclock secs (
Maybe I'm missing something, but doesn't this work?
use strict;
use warnings;
sub routine1 {
print "Calling routine2...\n";
routine2();
print "Done\n";
}
sub routine2 {
print "\tCalled by ", (caller(1))[3], "\n";
}
routine1();
output:
Calling routine2...
Called by main
It's tough to say from the code you have here. Have you tried printing out
$i, $key and all of $model to make sure they all have the values you expect?
I would run this through perl with the -d option to watch the values as they
change. If you haven't used the perl debugger before it's not hard
> How can I test whether a person's name (which is the variable called
> $vars::name) is in a particular file ( "links.dat")? The
> file is simply a
> list of names all separated by the newline character, i.e,
>
> Harry\n
> Joe\n
> Jane Doe\n
>
> When I change my pattern-to-match to the litera
>This is the code that fails me:
>
> $i=0;
> for $fields(split /&/, @data) {
> ($key, $value) = split /=/, $fields;
> $bigData{$model[$i]}{$key} = "$value";
> $i++;
> }
>
> It won't print out @data or @model f