Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Frustrating Error: "Global symbol requires explicit package name" - Can't see why?

by aitap (Curate)
on Aug 25, 2015 at 07:33 UTC ( #1139789=note: print w/replies, xml ) Need Help??


in reply to Frustrating Error: "Global symbol requires explicit package name" - Can't see why?

When you get a cryptic syntax error which you can't understand how you got, run through Basic debugging checklist, especially perl -MO=Deparse:
$ perl -MO=Deparse #!/usr/bin/perl use strict; use warnings; use threads; my $t1 = async { qx(perl process1); } my $t2 = async { qx(perl process2); } my @out1 = $t1->join; __END__ Global symbol "$t1" requires explicit package name at - line 10. - had compilation errors. use threads; use warnings; use strict; my $t1 = async(sub { `perl process1`; } , my $t2 = async(sub { `perl process2`; } , my(@out1) = ${'t1'}->join));
As Deparse clearly shows, absence of semicolons chained the calls to async and join together, making them arguments to each other.
  • Comment on Re: Frustrating Error: "Global symbol requires explicit package name" - Can't see why?
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1139789]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2023-03-22 18:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (60 votes). Check out past polls.

    Notices?