Link to home
Start Free TrialLog in
Avatar of saibsk
saibsk

asked on

perl flushing the variables

I am using a lot of variables in my Perl script. When loop thru an array and connect to the database and retreive 2 values and store them in variables and for the next value in the array if there is no values returned it stores these the previous values. How can i flush the variables in my script? I can do something like $data = "" for each of the variables. But there are a lot of them.
Avatar of ozo
ozo
Flag of United States of America image

see
perldoc -f reset
but how do you stores these the previous values if there is no values returned?
Avatar of saibsk
saibsk

ASKER

If I have something like this

if ($clientAbbrev =~ /(\S+).*?(\S+)/){
$clientabbr = $1;
$clientname = $2;
print "CLIENT1: $clientabbr\n";
print "Client2: $clientname\n";
}

The clientAbbrev is retreived from the DB. But the for the next time it loops the clientAbbrev is  empty it saves the value from the previous loop. How do I flush out the value?
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial