CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Using a hash as a reference is deprecated

 



liven
Novice

Mar 12, 2008, 8:19 AM

Post #1 of 3 (299 views)
Using a hash as a reference is deprecated Can't Post

Ok this is one of those errors that I am struggling to get rid of....


the error is pointing to this line of code ( the line with the %bad_files->)...




Code
 
if(@stuff != "0")
{
print "adding @stuff to Bad files\n";
%bad_files->{"$current_dir"} = "@stuff";
}


Do I need use a reference to the hash to prevent the error?


KevinR
Veteran


Mar 12, 2008, 10:58 AM

Post #2 of 3 (298 views)
Re: [liven] Using a hash as a reference is deprecated [In reply to] Can't Post

replace % with $:

$bad_files->{"$current_dir"} = "@stuff";

You don't need and really don't want the quotes around the scalar, that is a bad habit to get into when writing perl code:

$bad_files->{$current_dir} = "@stuff";


the quotes around the array will turn it into a scalar which is what I assume you want.
-------------------------------------------------


liven
Novice

Mar 12, 2008, 11:48 AM

Post #3 of 3 (295 views)
Re: [liven] Using a hash as a reference is deprecated [In reply to] Can't Post

Thanks I will try this.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives