If you break down what you've written into an English approximation, you
get something like this:

#####################

Create a variable $text, then assign $text the value 'hello';

Create a variable $text2, then assign $text2 the value 'bye';

Create a variable $text3, then substitute all instances of 'hello'
inside of $text3 with 'bye';

Print the contents of $text3

#####################

You are getting a warning because Perl is wondering why you want to
print an empty variable.

I'm wondering what you were expecting to happen.  It sounds like you
haven't gotten the hang of the s/// operator.  You might want to reread
the section of 'perldoc perlop' about "quotes and quote-like operators".




-----Original Message-----
From: Dave Adams [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 13, 2005 11:51 AM
To: beginners perl
Subject: Simple Substition Question

My Code:
------------------
#!/usr/bin/perl -w
use strict;
my $text= 'hello';
my $text2 = 'bye';
my $text3 =~ s/$text/$text2/g;
print $text3;

My Error:
---------------
F:\perlex\findpara.pl line 5.
Use of uninitialized value in print at F:\perlex\findpara.pl line 6.

My Questions:
-----------------------
Should perl give me a true or false? I am confused by this error.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to