Re: Variable/multi-line substitution
- From: Ian Wilson <scobloke2@xxxxxxxxxxxxx>
- Date: Wed, 22 Jun 2005 11:10:57 +0000 (UTC)
droman@xxxxxxxxxxxxxxxxx wrote:
<snip: description of objective>
I try to substitute as follows:
s/$dateIRIG_CHT 6/$dateIRIG_CHT 6\n$dateMBET_CHT 6\n.../i;
$dateIRIG_CHT is a valid variable name and , in your case, is likely to have no value set for it. You can use curly brackets to clarify what you want thus: ${date}IRIG_CHT
Try use strict; use warnings; as I believe is suggested in the posting guidelines for this newsgroup. This ought to catch this sort of error for you.
Obviously, I'm a Perl newbie and am getting the syntax wrong or using
substitution for too difficult of a task, because I can't get it to
work.
I suspect you could simplify your code by making better use of regular expressions in substitutions - you may not need a separate $date variable at all.
.
- Follow-Ups:
- Re: Variable/multi-line substitution
- From: Tad McClellan
- Re: Variable/multi-line substitution
- References:
- Variable/multi-line substitution
- From: droman
- Variable/multi-line substitution
- Prev by Date: Variable/multi-line substitution
- Next by Date: Activestate: how to read from a file or default to STDIN
- Previous by thread: Variable/multi-line substitution
- Next by thread: Re: Variable/multi-line substitution
- Index(es):
Relevant Pages
|