Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: Regexp and reading a file n-lines at time

by hbm (Hermit)
on Feb 03, 2010 at 18:24 UTC ( [id://821240]=note: print w/replies, xml ) Need Help??


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"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://821240]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2024-04-23 10:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found