my $output = undef; $output = qx(getfilesdata file.txt); # which is same as using back ticks $output = `getfilesdata file.txt`;