I am trying what you suggested (and thank you!) but its not working.
Huh? I didn't suggest that - I wrote about an editor (vi) command. But since you are bringing that up - re-read perlform, the chapter "Accessing Formatting Internals".
If you construct your format into a string, you have to either eval it -
my $format = '| @' . '>' x 10 . ' | ' . '@' . '<' x 10 . " |\n" . '$given, $surname' ."\n" . '.'; eval "format STDOUT = \n$format"; for ([qw(Bill Bruford)],[qw(Ginger Baker)]) { ($given, $surname) = @$_; write; } __END__ | Bill | Bruford | | Ginger | Baker |
or use formline and the accumulator $^A :
my $format = '| @' . '>' x 10 . ' | ' . '@' . '<' x 10 . " |\n"; for ([qw(Bill Bruford)],[qw(Ginger Baker)]) { formline( $format,@$_); print $^A; $^A = ''; } __END__ | Bill | Bruford | | Ginger | Baker |
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In reply to Re^3: format characters
by shmem
in thread format characters
by mikejones
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |