in reply to Re^3: Regexp and reading a file n-lines at time
in thread Regexp and reading a file n-lines at time
You may want to group your print statements; and you don't need to concatenate strings and variables (like "<title>".$Title."</title>") - you can print them together in one double-quoted string ("<title>$Title</title>").
Consider:
foreach $Title (keys %{$HASH}) { my $abstract = shift @{$HASH->{$Title}}; my $procedure = pop @{$HASH->{$Title}}; print $OUT "<title>$Title</title>\n", "<abstract>$abstract</abstract>\n", (map { "<recipe>$_</recipe>\n" }@{$HASH->{$Title}}), "<procedure>$procedure</procedure>\n"; }
|
|---|