in reply to string manipulation question
Interpolate the optional bit via a code reference @{[ ... ]} .
my $str = <<FOO; a load of constant stuff... @{["optional bit in the middle " if defined $option]} loads more stuff FOO
Beware that as this example stands, you'll get a newline regardless of whether $option is defined or not, but I'm sure you can figure out how to make it do The Right Thing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: string manipulation question
by Anonymous Monk on May 18, 2001 at 18:58 UTC |