muzza1962 has asked for the wisdom of the Perl Monks concerning the following question:

Hi All, I am using PHP's Perl extension available from the PECL web site at http://pecl.php.net/package/perl. It works apart from a problem with passing e-mail addresses in strings from PHP to Perl. I don't know how to put single quotes around the string within Perl as the PHP script breaks if I do that. There may be a way of preventing that behavior in PHP but my Perl knowledge is much stronger than PHP. An example is included below. If I don't single quote the e-mail address then it evaluates @test as an array which is empty. If I do single quote the e-mail address in Perl the PHP script breaks
<?php $phpemail = "test@test.com\n"; print "PHP email = $phpemail\n"; $perl = new Perl(); $perl->eval('$perlemail="test@test.com";print "Perl email = $perlemail\n"'); print "Bye!\n"; ?>

Replies are listed 'Best First'.
Re: Embedding Perl in PHP
by chargrill (Parson) on Sep 11, 2006 at 05:15 UTC

    Maybe try escaping your @ sigil?

    i.e.

    <?php $phpemail = "test\@test.com\n"; print "PHP email = $phpemail\n"; $perl = new Perl(); $perl->eval('$perlemail="test\@test.com";print "Perl email = $perle +mail\n"'); print "Bye!\n"; ?>


    --chargrill
    s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)