#!/usr/bin/perl use warnings; use strict; sub doWrite { my ($fh, $label, $count, $text) = @_; format DO_WRITE_FORMAT = @<<<<< @>>>> ^<<<<<<<<<<<<<<<<<<<<<<<<<<< $label,$count,$text ~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<< $text . select((select($fh), $~ = "DO_WRITE_FORMAT" )[0]); write $fh; } doWrite(\*STDOUT, "L1", 4567, "the quick brown fox jumped over the lazy fatass dog."); doWrite(\*STDERR, "L222", 12, "the large bulky dog ate the snippetty hyperactive fox.");