use strict; use warnings; use DBI; use DBIx::Library; my $dbh = DBI->connect() or die DBI->errstr; my $sql = new DBIx::Library( dbh => $dbh, quries => { offices => 'SELECT * FROM Offices', offices_x => 'SELECT $$what$$ FROM Offices', user => 'SELECT `username`, `profile` FROM users WHERE user_id = ?', user_x => 'SELECT $$which$$ FROM users WHERE user = ?', }, ); my $actual_SQL = $sql->offices->sql; my $offices_hash = $sql->offices->selectall_arraryref({Slice=>{}}) # and a final one using the subsitution $offices_hash = $sql->offices_x->(what => "`state`, `zip`")->selectall_arraryref({Slice=>{}}) my $user = $sql->user->selectrow_hashref(undef, $userid); $user_profile = $sql->user_x(which => 'profile')->selectrow_hashref(undef, $userid);