I'm pretty new to perl, and can't seem to get the following bit of code to work. If I print the array while in the sub, it returns what I want but outside of the sub it doesn't recognize it. Aren't all variable global by default unless told otherwise with "my"? Here is code below, any help would be appreciated.
#!/usr/bin/perl use 5.010; use diagnostics; # use strict; use Data::Dumper; sub getDig { $net = "10.0.1"; @num = (1..254); @digOutput = (); foreach (@num) { $ipaddie = $net . ".$_"; (@digOutput) = `dig -x $ipaddie +short`; } return \...@digoutput; } my @c = getDig(); my $dumped = Dumper(\...@c); print $dumped;