V
Vijai Kalyan
Hi,
I tried a modification of the example form the Camel Book pg. 12: The
modified program is below:
------------------------------------------------------------
#!/usr/bin/perl
# to test string splitting
# sample strings. we will split each string at the "."
@strings = ("org","org.htmlencoder","org.htmlencoder.element","org.htmlencoder.element.impl");
foreach $string (@strings) {
print "Processing string: ", $string, "$!\n";
@splitstring = split(".",$string);
foreach $component (@splitstring) {
print "Current component: ", $component, "$!\n";
$components{$component} = $component;
}
}
$index = 1;
foreach $component (sort keys %components) {
print "Component $index is: ", $component;
$index++;
}
----------------------------------------------------------
If I am right, this should produce the following output:
Processing string: org
Processing string: org.htmlencoder
Current component: org
Current component: htmlencoder
....
----------------------------------------------------------
But the only o/p I get is the "Processing string: " statements.
I am using Active Perl 5.8 alongwith the Open Perl IDE.
Suggestions?
thanx,
-vijai.
I tried a modification of the example form the Camel Book pg. 12: The
modified program is below:
------------------------------------------------------------
#!/usr/bin/perl
# to test string splitting
# sample strings. we will split each string at the "."
@strings = ("org","org.htmlencoder","org.htmlencoder.element","org.htmlencoder.element.impl");
foreach $string (@strings) {
print "Processing string: ", $string, "$!\n";
@splitstring = split(".",$string);
foreach $component (@splitstring) {
print "Current component: ", $component, "$!\n";
$components{$component} = $component;
}
}
$index = 1;
foreach $component (sort keys %components) {
print "Component $index is: ", $component;
$index++;
}
----------------------------------------------------------
If I am right, this should produce the following output:
Processing string: org
Processing string: org.htmlencoder
Current component: org
Current component: htmlencoder
....
----------------------------------------------------------
But the only o/p I get is the "Processing string: " statements.
I am using Active Perl 5.8 alongwith the Open Perl IDE.
Suggestions?
thanx,
-vijai.