i am participating in an online prog contest and only recently started learning perl.

I am programming in windows environment while the contest requires programs executable in linux environment.

The program takes input,a file name, as the first argument in the command line and generates output in the console itself with a new line character.

i start the code with #!/usr/bin/perl and procede with the code.
IT executes perfectly in my windows system with active perl configured while when i upload it to the site they dont accept it.

my question is are there any different ways to compile perl programs into directly executable scripts(this might sound stupid but the site specifically mentions that)

also,as a sample program the contest site gave a hello world program where the print doesnt end with semi colon,are there any perl interpreters don't read ;'s??

The semicolon is optional for the last statement in a block of Perl statements. I think that explains your seeing a one-liner ending in a print command not terminated with a semicolon.

There used to be a tool called perlcc that was included with each Perl version to compile scripts into executable binaries, but it never really worked very well, and it was excluded from Perl as of version 5.10. I don't know of any reliable way to create compiled binaries of Perl nowadays.

The following is the code,it should print the first triangle number that has more factors than number given as input to the file whose name is given as the argument.

#!/usr/bin/perl
open(num,$ARGV[0]);
$number=<num>;
close(num);
$i=1;
$totn=0;
while(1)
{
    $totn+=$i;
    $count=0;
    for($j=1;$j<=$totn;$j++)
    {
        if(($totn%$j)==0)
        {
            $count=$count+1;
        }
    }
    $i++;
    
    if($count>$number)
    {
        last;
    }
}
print "$totn\n"

No need to let not having a linux environment handicap you. Linux is free, and you don't have to uninstall Windows. I installed Ubuntu along with Windows as a dual-boot arrangement and now use Windows only occasionally. But you don't have to do that. You can run linux from a live-boot CD, from a thumb-drive, or lots of other ways that I haven't tried, but should be easy and free-of-charge. Try http://www.google.com/search?btnG=1&pws=0&q=try+linux+on+Windows

You may not even have to do that if you just want to know if the script you posted works in Linux. I tried it, and it does. Is there something else you need from here?

d5e5 is correct that there are literally dozens of Linux distributions that you can load to a flash drive and run them directly from there, if you just wanted to test your code. Here are instructions for installing Ubuntu on a flash drive:
https://help.ubuntu.com/community/Installation/FromUSBStick

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.