Set the output to "Insert as snippet" and wrap it in ${0:...}? you'll need to escape the ... bit of course.
Do you mean this:
#!/usr/bin/perl -w $m1=$m2=''; $c=1; while(<>) { if(/^\t{4}(.+)[\r\n]+$/) { $m1=$m2; $m2=$1; } $c++; last if($c==$ENV{'TM_LINE_NUMBER'}); } print "\n\n\t\t\t\t${0:$m1}";
...'cause that seems to work but inserts two too many tabs now.