Perl Scope problem

From: Dan Lyke <danlyke(at)flutterby(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Perl Scope problem
Date: 2001-05-06 14:17:17
Message-ID: 15093.23789.888047.926319@wynand.flutterby.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Randall Perry writes:
> I'm baffled by perl's scoping of variables.

You don't give exact error messages, but my guess is that this isn't a
scoping error, you're failing in get_cust_data(), so $cust_data is
undef and not a HASH ref. Imagine this rewritten as:

> $cust_data = {};
>
> while ($condition) {
> ...
>
> $cust_data = undef;
> print $cust_data->{'customer'};

Everyone else is right that all valid Perl programs start out:

#!/usr/bin/perl -Tw
use strict;

Dan

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-05-06 15:20:33 Re: I lost the pg_control file
Previous Message Christian Marschalek 2001-05-06 12:22:48 Sessions, Connections ...