This is PERL-beginners. For answering questions about the **Perl** language.
SAS was an interesting experiment twenty years ago.
B
On Sun, Jun 20, 2010 at 4:42 PM, papu wrote:
> Hi All,
>
> I would like to change SAS proc format to if-then-else statements. Can
> someone gui
Hi All,
I would like to change SAS proc format to if-then-else statements. Can
someone guid me? Thanks.
/*old file*/
%let _V0= var1; /* xnbntl75_n */
%let _V1= var2; /* pct_pay_bal_cyc_1 */
proc format;
value V_0_f/* var1 */
0 -<
On Fri, 8 Jun 2001, Jeff Yoak <[EMAIL PROTECTED]> wrote,
> At 05:35 PM 6/8/01 -0400, Luinrandir Hernson wrote:
> >ok, where did i go wrong now???
>
> '=' is the assignment operator in Perl. '==' is the numeric comparison
> operator and 'cmp' is the alpha which is what you want here. Ugly gotcha
On Sat, Jun 09, 2001 at 08:37:22PM +1000, iain truskett wrote:
> $previous = $ENV{HTTP_REFERER} ? $ENV{HTTP_REFERER} : 'an unknown site';
>
> Only one use of the variable name, thus easier to maintain =)
>
> Of course, there is a sideeffect in both this, the original and the one
> the original
> ok, where did i go wrong now???
> ##
> ##set $previous site var.
> ##
> if ($ENV{'HTTP_REFERER'} = "")
>{$previous = "an unknown site"}
>else
>{$previous = "$ENV{'HTTP_REFERER'}};
= instead of eq (string comparison), and in any case even
using the
On Jun 9, Jos I. Boumans said:
>$ENV{'HTTP_REFERER'} : $previous = $ENV{'HTTP_REFERER'} ? $previous = "an
>unknown site";
You didn't test that. Perl parses your code:
$a ? $b = $a : $b = $c;
as
(($a ? ($b = $a) : $b) = $c);
So that $b gets $c assigned to it no matter what. Either paren
* Jos I. Boumans ([EMAIL PROTECTED]) [09 Jun 2001 10:32]:
> and for some abbreviation:
> $ENV{'HTTP_REFERER'} : $previous = $ENV{'HTTP_REFERER'} ? $previous = "an
> unknown site";
[...]
> god bless one liners =)
Surely you mean:
$previous = $ENV{HTTP_REFERER} ? $ENV{HTTP_REFERER} : 'an unknown
site"
god bless one liners =)
hth,
Jos Boumans
- Original Message -
From: <[EMAIL PROTECTED]>
To: "Luinrandir Hernson" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, June 09, 2001 12:16 PM
Subject: Re: if then else
> shouldn't
shouldn't it be
if ($ENV{'HTTP_REFERER'} eq "")
?
Luinrandir Hernson wrote:
> ok, where did i go wrong now???
>
> ##
> ##set $previous site var.
> ##
> if ($ENV{'HTTP_REFERER'} = "")
>{$previous = "an unknown site"}
>else
>{$previous = "$ENV{'HTT
At 09:01 AM 6/9/01 +0200, M.W. Koskamp wrote:
>I think you dont need 'cmp' you need to use 'eq' in equations.
>cmp is the alfa comparison function for sort things and stuff right?
Ugh. I'd been up too long. I did mean 'eq' of course. The frightening
thing is that I wrote that during a short b
- Original Message -
From: Jeff Yoak <[EMAIL PROTECTED]>
To: Luinrandir Hernson <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, June 09, 2001 12:10 AM
Subject: Re: if then else
> At 05:35 PM 6/8/01 -0400, Luinrandir Hernson wrote:
> >o
Ok,
1.) if ( defined($ENV{'HTTP_REFERER'}) (make sure it's defined too)
2.) syntax. NOT if ($ENV{'HTTP_REFERER'} = "")
instead, try if ( $ENV{'HTTP_REFERER'} eq "" )
= :-: assignment
== :-: logic (numerics)
eq :-: logic (strings)
hope this helps,
~jon
--- Paul Johnson <[EMAIL PROTECTED
Ok,
1.) if ( defined($ENV{'HTTP_REFERER'}) (make sure it's defined too)
2.) syntax. NOT if ($ENV{'HTTP_REFERER'} = "")
instead, try if ( $ENV{'HTTP_REFERER'} eq "" )
= :-: assignment
== :-: logic (numerics)
eq :-: logic (strings)
hope this helps,
~jon
--- Paul Johnson <[EMAIL PROTECTED
Ok,
1.) if ( defined($ENV{'HTTP_REFERER'}) (make sure it's defined too)
2.) syntax. NOT if ($ENV{'HTTP_REFERER'} = "")
instead, try if ( $ENV{'HTTP_REFERER'} eq "" )
= :-: assignment
== :-: logic (numerics)
eq :-: logic (strings)
hope this helps,
~jon
--- Paul Johnson <[EMAIL PROTECTED
;} if $ENV{'HTTP_REFERER'};
or the even more terse.
my $previous = $ENV{'HTTP_REFERER'} || "an unknown site";
Peter C.
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 08, 2001 2:35 PM
On Fri, Jun 08, 2001 at 05:35:19PM -0400, Luinrandir Hernson wrote:
> ok, where did i go wrong now???
>
>
> ##
> ##set $previous site var.
> ##
> if ($ENV{'HTTP_REFERER'} = "")
>{$previous = "an unknown site"}
>else
>{$previous = "$ENV{'HTTP_REFERE
else
{$previous = "$ENV{'HTTP_REFERER'}}; #<--because you closed this if
statement here
-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 6/8/01 5:35 PM
Subject: if then else
ok, where did i go wrong now???
##
##set $
At 05:35 PM 6/8/01 -0400, Luinrandir Hernson wrote:
>ok, where did i go wrong now???
'=' is the assignment operator in Perl. '==' is the numeric comparison
operator and 'cmp' is the alpha which is what you want here. Ugly gotcha
since perl will hardly ever catch it for you. And damn all lang
On Fri, 8 Jun 2001, Luinrandir Hernson wrote:
> if ($ENV{'HTTP_REFERER'} = "")
>{$previous = "an unknown site"}
>else
>{$previous = "$ENV{'HTTP_REFERER'}};
Missing a terminating " on the last line there.
You should use ; to end lines as well. Makes life easier
when you a
ok, where did i go wrong now???
##
##set $previous site var.
##
if ($ENV{'HTTP_REFERER'} = "")
{$previous = "an unknown site"}
else
{$previous = "$ENV{'HTTP_REFERER'}};
20 matches
Mail list logo