[svn:perlfaq] r7996 - perlfaq/trunk

[email protected] Wed, 1 Nov 2006 00:24:41 -0800 (PST)
Newsgroups perl.cvs.perlfaq
Message-ID <[email protected]>
Author: comdog
Date: Wed Nov  1 00:24:38 2006
New Revision: 7996

Modified:
   perlfaq/trunk/perlfaq2.pod
   perlfaq/trunk/perlfaq4.pod

Log:

perlfaq4: How can I expand variables in text strings?
    + explained the templating example a bit more
    + cleansed whitespace

perlfaq2:  How can I get a binary version of perl?
    + Added Activestate and Sunfreeware (how did these
    go missing for so long?)

Modified: perlfaq/trunk/perlfaq2.pod
==============================================================================
--- perlfaq/trunk/perlfaq2.pod	(original)
+++ perlfaq/trunk/perlfaq2.pod	Wed Nov  1 00:24:38 2006
@@ -32,6 +32,15 @@
 
 =head2 How can I get a binary version of perl?
 
+For Windows, ActiveState provides a pre-built Perl for free:
+
+	http://www.activestate.com/
+
+Sunfreeware.com provides binaries for many utilities, including
+Perl, for Solaris on both Intel and SPARC hardware:
+
+	http://www.sunfreeware.com/
+
 If you don't have a C compiler because your vendor for whatever
 reasons did not include one with your system, the best thing to do is
 grab a binary version of gcc from the net and use that to compile perl
@@ -40,13 +49,13 @@
 
 Some URLs that might help you are:
 
-    http://www.cpan.org/ports/
-    http://www.perl.com/pub/language/info/software.html
+	http://www.cpan.org/ports/
+	http://www.perl.com/pub/language/info/software.html
 
-Someone looking for a perl for Win16 might look to Laszlo Molnar's djgpp
-port in http://www.cpan.org/ports/#msdos , which comes with clear
-installation instructions.  A simple installation guide for MS-DOS using
-Ilya Zakharevich's OS/2 port is available at
+Someone looking for a perl for Win16 might look to Laszlo Molnar's
+djgpp port in http://www.cpan.org/ports/#msdos , which comes with
+clear installation instructions.  A simple installation guide for
+MS-DOS using Ilya Zakharevich's OS/2 port is available at
 http://www.cs.ruu.nl/%7Epiet/perl5dos.html
 and similarly for Windows 3.1 at http://www.cs.ruu.nl/%7Epiet/perlwin3.html .
 

Modified: perlfaq/trunk/perlfaq4.pod
==============================================================================
--- perlfaq/trunk/perlfaq4.pod	(original)
+++ perlfaq/trunk/perlfaq4.pod	Wed Nov  1 00:24:38 2006
@@ -1006,9 +1006,13 @@
 
 (contributed by brian d foy)
 
-For example, I'll use a string that has two Perl scalar variables
-in it. In this example, I want to expand C<$foo> and C<$bar> to
-their variable's values.
+If you can avoid it, don't, or if you can use a templating system,
+such as C<Text::Template> or C<Template> Toolkit, do that instead.
+
+However, for the one-off simple case where I don't want to pull out a
+full templating system, I'll use a string that has two Perl scalar
+variables in it. In this example, I want to expand C<$foo> and C<$bar>
+to their variable's values.
 
 	my $foo = 'Fred';
 	my $bar = 'Barney';
@@ -1021,7 +1025,7 @@
 what's left in the string.
 
 	$string =~ s/(\$\w+)/$1/eeg; # 'Say hello to Fred and Barney'
-	
+
 The C</e> will also silently ignore violations of strict, replacing
 undefined variable names with the empty string.
 
@@ -1035,14 +1039,14 @@
 	my %Replacements = (
 		foo  => 'Fred',
 		);
-		
+
 	# $string =~ s/\$(\w+)/$Replacements{$1}/g;
 	$string =~ s/\$(\w+)/
 		exists $Replacements{$1} ? $Replacements{$1} : '???'
 		/eg;
-		
+
 	print $string;
-	
+
 =head2 What's wrong with always quoting "$vars"?
 
 The problem is that those double-quotes force