On Jan 23, 2008 10:04 AM, Bryan R Harris <[EMAIL PROTECTED]> wrote:

> Is there any way to change the last statement to do what I want, which in
> this case is print "perl is cool"?

Is this the kind of thing you're looking for?

    #!/usr/bin/perl

    use strict;
    use warnings;

    my $message = '$who is cool';
    my %includes;

    # .....

    $includes{'who'} = 'perl';

    (my $new_message = $message) =~ s/\$(\w+)/$includes{$1}/g;

    print "$new_message\n";

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

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


Reply via email to