in reply to Re^2: quotes in Perl
in thread quotes in Perl
This example, when run, produces the following:<font size="-1">#!/usr/bin/perl -w use strict; my $foo = 123.45; my $bar = "Martha Stewedprune"; print <<"EOT"; ===== This is an example of text taken literally except that variables are expanded where their variable names appear. foo: $foo bar: $bar EOT
===== This is an example of text taken literally except that variables are expanded where their variable names appear. foo: 123.45 bar: Martha Stewedprune
They way you quote, the end tag is important: like their regular quote counterparts, double-quotes allow expansion of variables and special characters, single quotes don't allow expansion. You may also have a bare, unquoted, end tag; this is equivalent to a double quote, i.e., expansion expansion.
Some warnings:
Prints just what we would hope:my $url = "http://www.maperl.com"; my $text = "Mother of Perl"; print <<"EOT"; <a href="$url">$text</a> EOT
<a href="http://www.maperl.com">Mother of Perl</a>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: quotes in Perl
by jZed (Prior) on Oct 21, 2004 at 02:35 UTC | |
by apotheon (Deacon) on Oct 21, 2004 at 06:20 UTC |