print "enter a number: ";
        $in = <>;
        chomp $in;
        print &prime($in);
        print "\n";

        sub prime{
        for($i=2;$i<($_[0]/2+1);$i++){
        if($_[0]%$i ==0){return "not prime\n"}
        }
        return "prime\n";
        }

can anyonet tell me, what program do i use to make this code work?..
i just found it on the internet while searching a formula for evaluating if a number is prime or composite..
i didn't see any program they tell to use this code..

well, it's not Java, I'll tell you that much.
never just "copy code". in this case, you don't even know what language it is, so, how do you know it 'll work?

looks like Perl to me, but then I'm again, it's been years since I worked with Perl, and there are tons of scripting languages I've never worked with, so ...

I would say Perl too based on the "chomp" function.

i think dollar symbol and all code refers to as php i think so not sure

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.