My script has a function that I want to just print its output in some
circumstances but in others I need to capture its output into an
array for further processing:

  sub strip_to_bone {
   if(/[Ss]ource/ && /[Dd]estination/){
      ($line = $line) =~ s/[Ss]ource/Src/g;
      ($line  = $line)  =~ s/[Dd]estination/Dst/g;
 $line  =~ s/(^[^ ]+, )([0-9][^ ]+ [0-9][^ ]+)(.*)(Src[^ ]+ [0-9]+)(.*)(Dst[^ ]+ 
[0-9]+)/$2 $4 $6/;
      $line = '';
      printf " %s %s %-28s %s\n", "<$.>", "$2", "$4", "$6";
  }
}

I've tried various renditions of sprintf and eval but my syntax is
still allowing the function to print to standard out. 

What is the correct way to do this so that the functions' output goes into
an array (simplified below):

 if ($opt_l){
      @c = sprintf(my_func());
#      @c = eval my_func();
       for (@c){
         print "Got it =>  $_\n";
       }
    }


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to