You might want to run your curl thru something like IPC::System::Simple. Then you can capture the return value and stuff it into $num for return thru the join.
# in your threads
use IPC::System::Simple
my $exit_value = runx(EXIT_ANY, "some_command", @args);