In article <[EMAIL PROTECTED]> wrote 
"Sanilkumar"
<[EMAIL PROTECTED]>:


> this program is not working please help me

Sorry, I couldn't find the error instantly.
But perhaps I can help you to improve your programming style.
1. Give your variables names that explain themselves. 
   Readability comes always first.
2. Use use strict; and use warnings;
3. Try to write more Perlish, not C-like.

> for(my $i=0;$i<3;$i++)
> {
>       my $r=$i+1;
>       print("Enter the  $r number");
>       local$a[$i]=<STDIN>;
             ^^ there should be a whitespace.
             Outside the loop, @a has no new values !!
> }

Perlish: print "Enter the $_ number", $a[$_-1] = <STDIN> for (1 .. 4);

> $first=0;
> $last=2;
> quicksort(\@a,$first,$last);
> system(clear);
> print("\t@a");
> sub quicksort(\@$$)
> {
>       my($num,$fi,$la)=@_;
>       print("\t$fi");
>       if($la > 0 && $fi!=$la)
Perlish: return unles $la > 0 && $fi != $la;
>       {
>               my $pivot=$num->[$fi];
>               my $spl=splitpoint(\@num,$fi,$la,$pivot);
>               my $wi = $spl-1;
>               my $ww = $spl+1;
>               if($wi > $fi)
>               {
>                       quicksort(\@num,$fi,$wi);
>               }
>               if($ww < $la)
>               {
>                       quicksort(\@num,$ww,$la);
>               }
Perlish:
my ($wi, $ww) = ($spl-1, $spl+1);
$wi > $fi and quicksort(\@num,$fi,$wi);
$ww < $la and quicksort(\@num,$ww,$la);
>       }
> }
> sub splitpoint(\@$$$)
> {
>       my($num,$fn,$ln,$pi)=@_;
>       do
>       {
>               while($num->[$fn] < $pi)
>               {
>                       $fn=$fn+1;
>               }
>               while($num->[$ln] > $pi)
>               {
>                       $ln=$ln-1;
>               }
>               if($fn<$ln)
>               {
>                       @{ $num }[$fn, $ln] = @{ $num }[$ln, $fn];
>               }
>       }while($fn < $ln);
Shouldn't it be a while (...) { ... } loop, if I remember correctly.
If so, Perlish:
while ($fn < $ln) {
    $fn++ while $num->[$fn] < $pi;
    $ln-- while $num->[$ln] > $pi;
    @{$num}[$fn,$ln] = @{$num}[$ln,$fn] if $fn<$ln;
}
> return($fn);
Why do you return a list and not a scalar value.
There's a big difference between
return $fn;
and
return ($fn);
> }
> 

Best Wishes,
Andrea






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to