muir@cae780.csi.com (David Muir Sharnoff) (02/23/91)
Unless I'm sadly mistaken, the following code should
not produce the following output:
config: Perl 3.044 and 4.0Beta, SunOS 4.0.3, Sun4, sun cc, yacc, perl malloc.
----- code ----
#!/usr/bin/perl
$run_new{'BDE'} = ' SPW1000-S4';
$run_new{'SDE'} = ' SPW1000-S4';
$run_new{'SPB'} = ' SPW1000-S4';
@foo = &killer(values(%run_new));
sub killer
{
print "bsplit.i[0] = '$_[0]'.\n";
print "bsplit.i[1] = '$_[1]'.\n";
print "bsplit.i[2] = '$_[2]'.\n";
print "ASPLIT1: ($#_) @_.\n";
print "bsplit.i[0] = '$_[0]'.\n";
print "bsplit.i[1] = '$_[1]'.\n";
print "bsplit.i[2] = '$_[2]'.\n";
}
------ output ------
bsplit.i[0] = ' SPW1000-S4'.
bsplit.i[1] = ' SPW1000-S4'.
bsplit.i[2] = ' SPW1000-S4'.
ASPLIT1: (2) SPW1000-S4 SPW1000-S4 SPW1000-S4.
bsplit.i[0] = ''.
bsplit.i[1] = ' SPW1000-S4'.
bsplit.i[2] = ' SPW1000-S4'.
------
Is this portable?
$a = " Jru tankohrstec\n rlhpe,ae"; %a = (0..26,0..26); grep (print ((split(//,$a))[$_]),keys(%a))
--
David Muir Sharnoff. "RISC is about one year ahead"
muir@csi.com (415) 358-3664 (415) 644-0441
Comdisco Systems Inc. 919 East Hillsdale Blvd, Foster City, CA 94404
lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (02/23/91)
Fixed. Thanks. : Is this portable? : : $a = " Jru tankohrstec\n rlhpe,ae"; %a = (0..26,0..26); grep (print ((split(//,$a))[$_]),keys(%a)) I believe so. Everyone uses the same hash function, and keys that small aren't going to overflow the hash value. Larry