jockel has asked for the wisdom of the Perl Monks concerning the following question:
I've got a strange problem .. inside a sub I've declared a variable as my with three possible values ..
1. 'limit $nmbr1,$nmbr2'
2. 'limit $nmbr2'
3. not defined/false/null .. whatever ..
Here is the code.
sub get_all_artid_from_kategoriid { my ($self) = shift; my (%params) = @_; my $LIMIT = 'limit ' . $params{'limitantal'} if (($params{'lim +itantal'}) && (!$params{'limitstart'})); $LIMIT = 'limit ' . $params{'limitstart'} . "," . $params{' +limitantal'} if (($params{'limitantal'}) && ($params{'limitstart'})); my $ORDNING = " order by $params{'order'} " if ($params{'order'}); my $GROUP = " group by $params{'groupby'} " if ($params{'groupb +y'}); print STDERR "LIMIT = $LIMIT || limitantal = $params{'limitantal'} +\n"; . some other code..... . }
The problem is that if I call the sub without the values 'limitstart' and 'limitantal' the STDERR row prints out
LIMIT = limit 20,20 || limitantal =
NOW comes the strange part ,, atleast for me....
If I change the code like this.
. . my $LIMIT; $LIMIT = 'limit ' . $params{'limitantal'} if (($params{'limita +ntal'}) && (!$params{'limitstart'})); $LIMIT = 'limit ' . $params{'limitstart'} . "," . $params{' +limitantal'} if (($params{'limitantal'}) && ($params{'limitstart'})); . .
Then the STDERR row prints out the following.
LIMIT = || limitantal =
Which I think the first code-example would do too..
Any ideas?? Am I still to tired? .. (GMT+1 = 11.34am)
Best regards
Jocke, Sweden
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: 'my' problems
by chb (Deacon) on May 23, 2005 at 10:16 UTC | |
by holli (Abbot) on May 23, 2005 at 10:34 UTC | |
by chb (Deacon) on May 23, 2005 at 10:39 UTC | |
|
Re: 'my' problems
by dave_the_m (Monsignor) on May 23, 2005 at 10:17 UTC | |
|
Re: 'my' problems
by wazoox (Prior) on May 23, 2005 at 10:16 UTC | |
|
Re: 'my' problems
by reasonablekeith (Deacon) on May 23, 2005 at 10:11 UTC | |
by jockel (Beadle) on May 23, 2005 at 10:18 UTC | |
by reasonablekeith (Deacon) on May 23, 2005 at 11:36 UTC | |
|
{pun,ot} [was:"Re: 'my' problems"]
by blazar (Canon) on May 23, 2005 at 10:22 UTC | |
|
Re: 'my' problems
by jockel (Beadle) on May 23, 2005 at 10:31 UTC | |
|
Re: 'my' problems
by mrpeabody (Friar) on May 23, 2005 at 22:06 UTC |