Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Yet table is used in a number of points elsewhere in the code. I would like to move it into a constant,#!/usr/bin/perl my $sql = 'SELECT table.field0, table.field1 FROM table;'; $sql =~ s/table.//g; print "$sql\n";
but I'm haven't figured out how to write the regular expression yet.use constant TABLE_NAME => 'table';
Can you guys help? TIA, you're are the coolest!$stmt =~ s/TABLE_NAME.//g; # doesn't work
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can I move a substitution string into a constant?
by tcf22 (Priest) on Nov 27, 2003 at 21:24 UTC | |
|
Re: Can I move a substitution string into a constant?
by Zed_Lopez (Chaplain) on Nov 27, 2003 at 21:31 UTC | |
|
Re: Can I move a substitution string into a constant?
by davido (Cardinal) on Nov 27, 2003 at 21:47 UTC | |
|
Re: Can I move a substitution string into a constant?
by ysth (Canon) on Nov 27, 2003 at 21:35 UTC | |
|
Re: Can I move a substitution string into a constant?
by Cody Pendant (Prior) on Nov 28, 2003 at 00:15 UTC | |
|
Re: Can I move a substitution string into a constant?
by CountZero (Bishop) on Nov 27, 2003 at 21:47 UTC |