sivasakthi schreef:
> I have the two variables, like below,
>
> $val1=[15/Apr/2005:11:46:35 +0300];
> $val2=[12/Nov/2007:14:59:00 +0530];
In stead of using such numbers in variable names, use an array.
my @dates;
$dates[0] = q[15/Apr/2005:11:46:35 +0300];
$dates[1] = q[12/Nov/2007:14
>
> What you've written isn't valid Perl, so I shall have to guess at what
> you might mean. If you have two strings like this
>
>$val1 = '15/Apr/2005:11:46:35 +0300';
>$val2 = '12/Nov/2007:14:59:00 +0530';
>
> then you can compare them with eq, like this
>
>print "equal" if $val1
sivasakthi wrote:
Hi all,
I have the two variables, like below,
$val1=[15/Apr/2005:11:46:35 +0300];
$val2=[12/Nov/2007:14:59:00 +0530];
I want to check these two variables are equal or not.. I know the method
of splitting the each column and compare it.. but it too large.. is it
possible to ch
the simplest way:
if ( $val1 eq $val2 ) {
do something...
} else {
do another thing...
}
but, since this is a datetime string, for better control, you may want
to take the way of comparing them with time. see some modules like
Time::Local.
On Nov 17, 2007 12:36 PM, sivasakthi <[EMAIL PRO
Hi all,
I have the two variables, like below,
$val1=[15/Apr/2005:11:46:35 +0300];
$val2=[12/Nov/2007:14:59:00 +0530];
I want to check these two variables are equal or not.. I know the method
of splitting the each column and compare it.. but it too large.. is it
possible to check with easily??