That is the way to do it. It can get a little confusing at first, but once
you get used to doing things that way it will become 2nd nature. 

--Joe Breeden

--------------------------
Sent from my Outlook 2000 Wired Deskheld (www.microsoft.com)


> -----Original Message-----
> From: swade [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 14, 2001 2:53 PM
> To: [EMAIL PROTECTED]
> Subject: my()
> 
> 
> Hi, I'm completly confused by this my(X) not being available 
> outside of a
> subroutine, I've read everything but must not still get 
> it....is this an
> approriate solution? it makes @countries available...
> 
>  my @countries; <- solution?
>  my $sql = "select distinct country from geo";
>  my $sth = $match::dbh->prepare( "$sql" );
>  $sth->execute;
>  while ( (my $country_db) = $sth->fetchrow )
>  {
>   push(@countries,"$country_db");
>  }
> 
> I've read the solutions but dang if they don't seem like 
> rocket science for
> something simple. Like suppose I wanted to do this
> if ($var eq "whatever) {
>     $sql = "select.....yada";
> } else {
>     $sql="somthing else...";
> }
> dbi $sql stuff
> In this case $sql wouldn't be available and use strict would 
> complain. So if
> I did this:
> my ($sql);
> if....as above
> 
> Is that an appropiate solution?
> 
> Thanks for _any_ info anyone can provide,
> shawn
> 
> 

Reply via email to