Odd to me anyway...
perl -Mstrict -e'my $num = 1; print 1 if $num >= 1; print 2 if $num =>
+ 1;'
Works as I'd expect. As does The following code does what Id expect.
#!/usr/bin/perl
use strict;
use warnings;
use Carp;
use DBI;
use Data::Dumper;
# Connection
my $dsn = qq|dbi:Informix:sysmaster|;
my $dbh = DBI->connect($dsn) or confess DBI->errstr();
$dbh->{'RaiseError'} = 1;
$dbh->{'ChopBlanks'} = 1;
# Hash to hold all info about tables...
my %dbinfo;
# Get info on extents...
{
my $query = qq|select count(*), tabname
from sysextents
group by tabname|;
my $sth = $dbh->prepare($query) or confess DBI->errstr();
$sth->execute or confess DBI->errstr();
my ( $count, $table );
$sth->bind_col(1, \$count);
$sth->bind_col(2, \$table);
while ( $sth->fetchrow )
{
next unless $count >= 8;
$dbinfo{$table}{'extents'} = $count;
}
}
print Dumper %dbinfo;
END { $dbh->disconnect }
which outputs
__snip__
$VAR77 = 'abcde';
$VAR78 = {
'extents' => 14
};
$VAR79 = 'abcdef';
$VAR80 = {
'extents' => 33
};
$VAR81 = 'abcdefg';
$VAR82 = {
'extents' => 93
};
$VAR83 = 'abcdefgh';
$VAR84 = {
'extents' => 17
};
but when I change line 35 to
next unless $count => 8;
I get all table extents returned.
__snip__
$VAR2949 = 'abcdefgh';
$VAR2950 = {
'extents' => '4'
};
$VAR2951 = 'abcdefghi';
$VAR2952 = {
'extents' => '1'
};
$VAR2953 = 'abcdefghij';
$VAR2954 = {
'extents' => '1'
};
$VAR2955 = 'abcdefghz';
$VAR2956 = {
'extents' => '1'
};
$VAR2957 = 'abcdefghp';
$VAR2958 = {
'extents' => '1'
};
$VAR2959 = 'abcde';
$VAR2960 = {
'extents' => '1'
};
$VAR2961 = 'abcderr';
$VAR2962 = {
'extents' => '1'
};
$VAR2963 = 'abcdewe';
$VAR2964 = {
'extents' => '1'
};
Just curious as to the why of this.
perl is old ( nothing I can do about it either, upgrades are scheduled ), Output of perl -v is
This is perl, v5.8.3 built for x86_64-linux-thread-multi
updateupdated mis-spelled node title...
update2The command line example is actually the odd behavior. So to restate my question, why does that output 12?
update3If I could only -- myself, I would, on this one. Whats the point of use warnings; if you don't read them?
Ted
--
"That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved."
--Ralph Waldo Emerson