in reply to Re^2: formline, undefined format STDOUT
in thread formline, undefined format STDOUT

As documented in perlform, ~~ should be used for changing values that finally become undefined.
#!/usr/bin/perl use warnings; use strict; my @l = ('This is long string', 'Another long one'); my @s = ('s', 'S'); format = ~~ @<<<<<<<<<<<<<<<<<<< @< shift @l, shift @s . write;

It's time you read the documentation again. I've never used formats in Perl, and I hope I never will; but I was able to put this together in one minute.

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^4: formline, undefined format STDOUT
by Anonymous Monk on Apr 20, 2015 at 17:23 UTC

    Thnx for your help, this is what I was looking for :

    #!/usr/bin/perl use warnings; use strict; my @row; my @f_map = ('f1', 'f2'); my $f = "format = \n" . ('^' . '<' x 15 . '|') x scalar(@f_map) . "\n" . '@row' . "\n" . ('^' . '<' x 15 . '|') x scalar(@f_map) . "~~\n" . '@row' . "\n" . ".\n"; eval($f); # @row = ('blah1' x 10, 'blah2' x 10); write;

    output :

    blah1blah1blah1b|blah2blah2blah2b| lah1blah1blah1bl|lah2blah2blah2bl| ah1blah1blah1bla|ah2blah2blah2bla| h1 |h2 |