Tom Allison wrote:
I've been using the practice of putting something at the bottom of a
file for holding static data, like SQL, by calling a __DATA__ handle:

my $sql = join('',(<DATA>));

#more efficient
my $sql = do { local $/; <DATA> };

check perldoc perlvar if you want to know more about $/

__DATA__
select .....


Is there any way to do this twice?
To define two sets of static SQL?

I guess that you don't really want to read two times from <DATA> but to somehow separate text below __DATA__

(undef, my %static_sql)
  = split /#(\w+)\s+/, do { local $/; <DATA> };

use Data::Dumper;
print Dumper \%static_sql

__DATA__
#select1
select * from table1 ..

#select2
select * from table2 ..

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


Reply via email to