The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

Perl code help for a newbie

ZetaZeta Registered User regular
edited July 2007 in Help / Advice Forum
Hey guys,

I am new to the whole perl thing and was wondering: Is it possible to get perl to execute something via the command line and hold the results as a variable? For instance I have a perl script that is going to run in unix and at a certain point i want the perl script to use the command line to execute 'cksum $filename' in order to do a checksum on a certain file and save the results to a variable. The problem is i have no idea how to make perl use the command line. Any help would be great.

Thanks.

Zeta on

Posts

  • LewishamLewisham Registered User regular
    edited July 2007
    Lewisham on
  • RhinoRhino TheRhinLOL Registered User regular
    edited July 2007
    yea, few ways to do it:
    my $output = `cksum $filename`;
    print ("Cksum outputted: $output\n");
    
    # or also this works:
    system("chksum", "$filename");
    

    I forget how to get the system output though.

    Rhino on
    93mb4.jpg
Sign In or Register to comment.