in reply to Re: using perl variable in muliple modules
in thread using perl variable in muliple modules

thanks for the help :) okay, another related question:
($self, $keyword, $keyword2, $keyword3, $keyword4, $keyword5, $keyword +6, $domain) = (@_);
That's how I'm getting a series of values into a module, which seems to be working...however, when I parse those with this:
$sub1 = $keyword; $sub2 = $keyword2; $sub3 = $keyword3; $sub4 = $keyword4; $sub5 = $keyword5; $sub6 = $keyword6; $noun1 = &makeNlink($sub1, $domain); $noun2 = &makeNlink($sub2, $domain); $noun3 = &makeNlink($sub3, $domain); $noun4 = &makeNlink($sub4, $domain); $noun5 = &makeNlink($sub5, $domain); $noun6 = &makeNlink($sub6, $domain);
and then this is the sub &makeNlink
sub makeNlink { #($tobelink, $tobelinkurl) = @_; $tobelink = shift(@_); $tobelinkurl = shift(@_); $withspaces = $tobelink; $tobelink =~ s/\s/_/g; chomp($withspaces); chomp($tobelink); $totallyscrewed = "<a href \= \"http\:\/\/$domain\/$tobelink\" +>$withspaces<\/a>"; return $totallyscrewed; }
The values are used over and over, the same series each time, when in the main script they are totally different. How do I make sure the current value of each variable is imported into this module? Thanks very, very much for the help! This place rocks.

Replies are listed 'Best First'.
Re (tilly) 3: using perl variable in muliple modules
by tilly (Archbishop) on Jan 03, 2002 at 21:16 UTC
    I suspect from your question that you are having problems with overwriting the value of your variables. If so then what you need to do is stop using so many global variables. I strongly recommend reading Coping With Scoping to understand how to avoid having variables trample all over each other, and then strict.pm to find out how to let Perl give you feedback to avoid mistakes.