Please send questions to
st10@humboldt.edu .
#!/usr/bin/perl -w
#######################################################
# lect04_join_ex
#
# example of split and join operators
#
# last modified: 9-14-04
#######################################################
# @line_vals has a separate value for each value after a :
@line_vals = split /:/, "the rain:in Spain:stays mainly:in the plain";
foreach $val (@line_vals)
{
print "NEXT LINE VAL:$val\n";
}
# now join 'em together into a SINGLE string with a DIFFERENT
# separator...
$newline = join "%-%", @line_vals;
print "new joined line is: $newline\n";
# end of lect04_join_ex