[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] q{} is your friend. shell escaping is not :)



I was wondering something though.  Which one would you do?:

sub goofy_a {
    my $sql = <<'EOF';
        SELECT Foo
        FROM Bar
        WHERE Foo IS NOT NULL
EOF
    return $sql;
}

or

sub goofy_b {
    my $sql = q{
        SELECT Foo
        FROM Bar
        WHERE Foo IS NOT NULL
    };
    return $sql;
}

I like goffy_b because I don't have to have the EOF terminator in column 1 but I think PerCritic complains about using q{} over multiple lines.

On 2/3/2010 4:22 PM, Jay Hannah wrote:
These do the same thing. But the bottom is more readable, I think.
Thanks q{}!

my $cmd = "ssh -l bkgndrun $server " . 'perl -e \\\'print join \" \",
@INC\\\'';

my $cmd = "ssh -l bkgndrun $server " . q{perl -e \'print join \" \",
@INC\'};

perldoc perlop

Quote and Quote-like Operators

j



_______________________________________________
Omaha-pm mailing list
Omaha-pm@pm.org
http://mail.pm.org/mailman/listinfo/omaha-pm

--
Todd Hamilton
(402) 881-0438