in reply to Why does this code quit?

Your format is busted. That's not the way formats work. You'll have to be quite explicit:
format ADDRESS = @<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< "NAME", "$first $last" @<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< "THIS", $that .
etc.

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Replies are listed 'Best First'.
Re: Re: Why does this code quit?
by ellem (Hermit) on Feb 01, 2002 at 14:32 UTC
    Yikes! You are right. Is there a better way?
    --
    ellem@optonline.net
    There's more than one way to do it, just don't use my way.
      You could do something like:
      my ($field, $value); # then, inside your loop... ... { ... my @lines = ( [ "NAME", "$fname $lname" ], [ "AGE", $age ], [ "WHATEVER", $whenever ], # ... ); for (@lines) { ($field, $value) = @$_; write FORMAT; } ... } ... format FORMAT = @<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $field, $value .

      _____________________________________________________
      Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
      s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;