- or download this
#!/usr/bin/perl
...
my(@array1) = (1, 2, 3, 4);
my(@array2) = ('a', 'b', 'c', 'd', 'e', 'f');
- or download this
push my @array3, @array1, @array2;
- or download this
Parentheses missing around "my" list at try.pl line 12.
- or download this
push (my @array3, @array1, @array2);
- or download this
push (my @array3, @array1, @array2);
- or download this
push my @array3, @array1, @array2;
- or download this
#!/usr/bin/perl
...
foreach my $enum_type ( eval $enum_types ) {
print qq[<option value="$enum_type">$enum_type</option>\n];
}
- 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];
}
- or download this
while ( $enum_types =~ m/('(.*?)'|([^']*?))($|,\s*)/g ) {
my $match = $3 || $2;
print qq[<option value="$match">$match</option>\n] if $match;
}
- or download this
#!/usr/bin/perl
...
foreach my $enum_type ( split /(?:^'|','|'$)/, $enum_types ) {
print qq[<option value="$enum_type">$enum_type</option>\n];
}
- 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>
- 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";
- or download this
and all is quiet...