package Some::Third::Party::Module; # ... sub doSomething { say "This will take some time"; sleep 10; say "Done"; } # ... #### #!/usr/bin/perl # ... use Some::Third::Party::Module qw( doSomething ); # ... open my $h,'>:raw','output.bin'; my $oldSelected=select $h; print "\x00\x42\xAF\x99"; doSomething(); print "\x33\xFF\x81\x73"; select $oldSelected; close $h; #### open my $h,'>:raw','output.bin'; print $h "\x00\x42\xAF\x99"; doSomething(); print $h "\x33\xFF\x81\x73"; close $h; #### open my $h,'>:raw','output.bin'; my $oldSelected=select $h; print "\x00\x42\xAF\x99"; select $oldSelect; doSomething(); select $h; print "\x33\xFF\x81\x73"; select $oldSelected; close $h;