Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003

    Question Unanswered: Calling a perl script with arguments...

    I'm kinda new to perl and have stumbled onto a problem. I have a script I want to call, all it does is pass the arguments I use on the command line to another machine that has a perl written server waiting to do something depending on the argument I used to run the perl script.

    I run: perl shutdown
    On second box the server gets a shutdown command from the i have running.

    My problem is how do I get my perl script to do something with the argumnents? I though I found the solution when I stumbled onto @ARGV, but I can't seem to get the value of that into my $command

    Any tips?

  2. #2
    Join Date
    Jan 2004
    #! /usr/bin/perl
    use strict;
    use warnings;
    my %commands = (shutdown => \&shutd,
                   showmessage => \&showm);
    sub shutd{
      my $rc = `shutdown-command`;
    sub showm{
      print "I'm asked to print something";
    } - The German Perl-Community

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts