in reply to string concatenation
I would have done it differently. Personal preference dictates that I code like so:
my $str = "<P_contrib-author>Mariel Miller</P_contrib-author>,<P_contr +ib-author>Allyson Fiona Hadwin</P_contrib-author>,<P_contrib-author>J +enna Cambria</P_contrib-author>"; my @rawauthours = split( ",", $str ); my @authours = (); foreach (@rawauthours) { $_ =~ /<P_contrib-author>(.*)<\/P_contrib-author>/; push( @authours, $1 ); } print '<alt-title alt-title-type="running-head-verso">', join( ", ", @authours ), '</alt-title>';
If you want to make your script work, you should probably remove the willdcard(?), making it:
while($line =~ /<P_contrib-author>(.*)<\/P_contrib-author>/)
...but I am not sure about that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: string concatenation
by maha (Novice) on Dec 28, 2011 at 08:23 UTC |