in reply to Parsing Text from Object Header that prints to STDOUT

if everything else fails, you can use a forking open call (see open docs on perlfunc):
#!/usr/bin/perl use warnings; use strict; use Carp; my $pid = open my $pipe, '-|'; defined $pid or croak "unable to fork"; if ($pid==0) { # child process print "SCORE=134"; # my $aln2 = $factory->align($seq_array_ref); exit(0); } else { # parent process my $score; while(<$pipe>) { if (/SCORE=(\d+)/) { $score=$1; last; } } print "score=$score\n"; }
be aware that forking can cause problems if you have open connections to databases or some other resources.

also, $aln2 will only have a value assigned on the child process.