[Pdx-pm] method required text, how do I give it a variable?

Tom Phoenix rootbeer at redcat.com
Thu Jun 17 10:01:55 CDT 2004

On Tue, 15 Jun 2004, Thomas J Keller wrote:

> my @apples = <<EOL =~ m/\S.*\S/g;
> 	qq(tell application "Finder"\\n
> 		activate\\n
> 		display dialog "Greetings from Perl!"\\n
> 	end tell)
> my $string = join "", @apples;
> print "$string\n";

The string has a literal qq() in it, since you don't want both a qq()  
and a here-document at the same time. It's also got literal backslash-n
combinations where you need a newline.

You may use something like this to get your string, optionally including 
some interpolated strings in this here-doc if you wish:

my $string = <<EOL;
        tell application "Finder"
                display dialog "Greetings from Perl!"
        end tell

Good luck with it!

--Tom Phoenix

More information about the Pdx-pm-list mailing list