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";
        }

is this code for c++ language?..

No idea what that is

Can you not just take some code, then go onto different forums (Java, C++) etc.. and ask what the code is, if you don't know what the code does, or, even what language it is in; why are you using it?

It looks like Perl, or, some other scripting language..

Can you not just take some code, then go onto different forums (Java, C++) etc.. and ask what the code is,

You shouldn't. You should post in a more generic forum (Computer Science) so you post only once. Also, since you don't know what language it is, posting Perl code in the C++ or Java forum is frowned upon -- therefore Computer Science.

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.