> Message du 28/08/08 12:20
> De : "Irfan J Sayed (isayed)"
> A : beginners@perl.org
> Copie à :
> Objet : search value in array
>
> Hi All,
>
> I want to search whether specific value/data is there are not in Array.
> For example lets say i have array as follows.
>
> @test = (1,2,3,4,5);
> $rel1=4;
>
> I need to check whether 4 is there or not. 

The intuitionistic way,

for (@test) {
    if ($_  == $rell){
        print "exist\n";
        last;
    }
}



>

> but i think this is not the proper way because if i use grep then it
> would be a platform dependant.
>

why "grep" is platform dependant? I didn't know that.


Regards,
Jeff.

 Créez votre adresse électronique [EMAIL PROTECTED] 
 1 Go d'espace de stockage, anti-spam et anti-virus intégrés.

Reply via email to