"I am getting the unix command from html form and executing it in perl"

Your code in unix.pl looks as though it's actually running under Windows. If you're expecting your Windows machine to execute a unix command by simply using system this isn't going to work, you need to connect to the unix machine. At this point you need to ask yourself if you really want a text input box where users can provide anything they like and have it run simply by clicking a button. What if text input t1 contained rm -rf?

"It returns me 256. I am new to perl programming and please help me"

You don't tell us which command you run, for all I know 256 is exactly what it's supposed to return. If you don't explain what problems you're having it is not possible to offer a great deal of help.

You have no use strict; use warnings; in your perl code. unix.pl has use CGI ':standard'; yet manually print a header. Since you're new to Perl I suggest you spend time reading and understanding the following:


In reply to Re: Execute unix command thro' perl in windows by marto
in thread Execute unix command thro' perl in windows by mailtogpriya

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.