Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

serf's scratchpad

by serf (Chaplain)
on Mar 03, 2005 at 20:08 UTC ( #436355=scratchpad: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    
    ...
    
    my(@array1) = (1, 2, 3, 4);
    my(@array2) = ('a', 'b', 'c', 'd', 'e', 'f');
    
  2. or download this
    push my @array3, @array1, @array2;
    
  3. or download this
    Parentheses missing around "my" list at try.pl line 12.
    
  4. or download this
    push (my @array3, @array1, @array2);
    
  5. or download this
    push (my @array3, @array1, @array2);
    
  6. or download this
    push my @array3, @array1, @array2;
    
  7. or download this
    #!/usr/bin/perl
    
    ...
    foreach my $enum_type ( eval $enum_types ) {
        print qq[<option value="$enum_type">$enum_type</option>\n];
    }
    
  8. or download this
    my $enum_types = "'On Order','Waiting, Pending Payment','Dispatched','
    +Cancelled','Renewal','Amend\'ed'";
    # NB: one value has a , in it and another a ' just to make this challe
    +nging... ;-)
    ...
    foreach my $enum_type ( eval $enum_types ) {
        print qq[<option value="$enum_type">$enum_type</option>\n];
    }
    
  9. or download this
    while ( $enum_types =~ m/('(.*?)'|([^']*?))($|,\s*)/g ) {
        my $match = $3 || $2;
        print qq[<option value="$match">$match</option>\n] if $match;
    }
    
  10. or download this
    #!/usr/bin/perl
    
    ...
    foreach my $enum_type ( split /(?:^'|','|'$)/, $enum_types ) {
        print qq[<option value="$enum_type">$enum_type</option>\n];
    }
    
  11. or download this
    $ ./try.pl
    <option value=""></option>
    ...
    <option value="Cancelled">Cancelled</option>
    <option value="Renewal">Renewal</option>
    <option value="Amen'ded">Amen'ded</option>
    
  12. or download this
    my $command = '/usr/local/bin/program_with_multiline_output';
    chomp(my(@output) = `$command`);
    ...
    my $returned = $? >> 8;
    print "Returned: [$returned]\n";
    print "Message: [$output]\n";
    
  13. or download this
    and all is quiet...
    

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2015-05-25 08:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (479 votes), past polls