Help for this page

Select Code to Download


  1. or download this
      #! /usr/local/bin/perl -w
      print "Hello, world\n";
    
  2. or download this
      #! /usr/local/bin/perl -w
      use strict;
      my $thing = shift(@ARGV);
      print "Hello, $thing\n";
    
  3. or download this
      #! /usr/local/bin/perl -w
      use strict;
      my $thing = shift;
      print "Hello, $thing\n";
    
  4. or download this
      #! /usr/local/bin/perl -w
      use strict;
      my $thing = shift || 'world';
      print "Hello, $thing\n";
    
  5. or download this
      #! /usr/local/bin/perl -w
      use strict;
      my $thing = shift or die "Nothing specified on the command line.\n";
      print "Hello, $thing\n";
    
  6. or download this
      my $thing = shift || 'default';
    
  7. or download this
      my $thing = shift;
      $thing ||= 'default' unless defined $thing;
    
  8. or download this
      #! /usr/local/bin/perl -w
      use strict;
    ...
         $switch = undef if $switch;
      }
      print $switch ? 'Goodbye' : 'Hello', ", $thing\n";
    
  9. or download this
      #! /usr/local/bin/perl -sw
      use strict;
      use vars qw/$g/;
      my $thing = shift || 'world';
      print $g ? 'Goodbye' : 'Hello', ", $thing\n";
    
  10. or download this
      #! /usr/local/bin/perl -w
      use strict;
    ...
      getopt('g');
      my $thing = shift || 'world';
      print $opt_g ? 'Goodbye' : 'Hello', ", $thing\n";
    
  11. or download this
      #! /usr/local/bin/perl -w
      use strict;
    ...
      getopt('g', \%args);
      my $thing = shift || 'world';
      print $args{g} ? 'Goodbye' : 'Hello', ", $thing\n";
    
  12. or download this
    Getopt::Mixed::init( 'j=s l:s p=i s=s t=s logfile>l d>p date>p period>
    +p project>
    j type>t');
    
  13. or download this
      while( my( $option, $value, $pretty ) = Getopt::Mixed::nextOption() 
    +) {
        OPTION: {
    ...
      }
      Getopt::Mixed::cleanup();
      die "No project specified via -j.\n" unless $Project;