perl + identify if param is empty value from ARG

Tags: , , ,
Posted in dotnet, vb, vb.net | 63 Comments »

Hi all,

when I run the following script.pl script with no arguments:

./script.pl

I do not get the message No arg. Why? How to identify if $param is a null value or empty value, same as [ -z from ksh?

#!/usr/bin/perl
my $param = $ARGV[0];
if ($param = "") {
    print No arg;
} else {
    print arg: $param;
}

Similar:

  1. shell script (ksh) + compare sign as param is it possible?? hi Subject shell script if I perform compare on the following [[ 2 -eq 2 ]] && print OK I get OK But how to...
  2. Perl: How to pass and use a lexical file handle to a subroutine as a named argument? I want to pass a lexical file handle to a subroutine using a named argument, but the following does not compile: #!/usr/bin/perl -w use strict;...
  3. taint-mode perl: preserve suid when running external program via system() I’m trying to add a feature to a legacy script. The script is suid, and uses perl -T (taint mode: man perlsec), for extra security....
  4. How do I best pass arguments to a Perl one-liner? Hi, I have this file like this: $cat a hdisk1 active hdisk2 active I use this shell script to check: $cat a.sh #!/usr/bin/ksh for d...
  5. Simple http redirect is failing with Perl 5.8.9 and IIS6 We recently started a move of our web sites to Server 2003 from 2000 while upgrading Perl from 5.6 to 5.8. Most of our web...

Tags: , , ,

63 Responses to “perl + identify if param is empty value from ARG”

  1. [...] perl + identify if param is empty value from ARG | The Largest … [...]

  2. [...] perl + identify if param is empty value from ARG | The Largest … [...]

  3. [...] perl + identify if param is empty value from ARG | The Largest … [...]

  4. [...] perl + identify if param is empty value from ARG | The Largest … [...]

  5. [...] perl + identify if param is empty value from ARG | The Largest … [...]

  6. [...] perl + identify if param is empty value from ARG | The Largest … [...]

  7. [...] perl + identify if param is empty value from ARG | The Largest … [...]

  8. [...] perl + identify if param is empty value from ARG | The Largest … [...]

  9. [...] perl + identify if param is empty value from ARG | The Largest … [...]

  10. [...] perl + identify if param is empty value from ARG | The Largest … [...]

  11. [...] perl + identify if param is empty value from ARG | The Largest … [...]

  12. [...] perl + identify if param is empty value from ARG | The Largest … [...]

  13. I’m trying to change the entire background of my blogspot. I can get it on the left side, but the sidebar still remains at the ugly solid color. any help?.

Leave a Reply