 |
|
Home:
Perl Programming Help:
Beginner:
Re: [Laurent_R] Use subroutine instead die message:
Edit Log
|
|

waldauf
Novice
Aug 23, 2012, 2:54 AM
Views: 988
|
|
Re: [Laurent_R] Use subroutine instead die message
|
|
|
Hello coll's, I'm sorry I removed the original post of this topic so I created it here. I have problem with calling subroutine instead of "die message". I replaced "die message" by subroutine but this solution didn't work. Perl code for reading input argument:
sub BadInputParam_s { print <<EOF; Input parameter: @_ is not allowed. For more information use help screen. EOF exit 1; } GetOptions ('channel=s' => \$channel, 'state=s' => \$state) or BadInputParam_s(@ARGV); ~ Output:
$ ./remote_channel_ctrl.pl $ Perl code for reading input argument. Somewhere I read I have to call subroutine like scalar variable:
sub BadInputParam_s { print <<EOF; Input parameter: @_ is not allowed. For more information use help screen. EOF exit 1; } ~ GetOptions ('channel=s' => \$channel, 'state=s' => \$state) or $BadInputParam_s(@ARGV); ~ Output
$ ./remote_channel_ctrl.pl Variable "$help_s" is not imported at ./remote_channel_ctrl.pl line 104. (Did you mean &help_s instead?) Global symbol "$help_s" requires explicit package name at ./remote_channel_ctrl.pl line 104. syntax error at ./remote_channel_ctrl.pl line 107, near "print" Execution of ./remote_channel_ctrl.pl aborted due to compilation errors.
(This post was edited by waldauf on Aug 23, 2012, 6:10 AM)
|
|
|
Edit Log:
|
|
Post edited by waldauf
(Novice) on Aug 23, 2012, 5:58 AM
|
|
Post edited by waldauf
(Novice) on Aug 23, 2012, 6:10 AM
|
|
|  |