in reply to Re: Remove new line characters
in thread Remove new line characters
$td_switch=0; open(DAT, $data_file)|| die("Could not open file!"); while (<DAT>){ if ($td_switch){ if (m/.*?<\/td>.*$/i){ ($extract_rest, $_) = /(.*?)<\/td>(.*)$/i; $td_switch = 0; $extract .= "\n" . $extract_rest; push (@parsed_data, $extract); #print "$_\n\n"; }else{ ($extract_rest) = /(.*?)$/i; $extract .= "\n" . $extract_rest; } } while (m/<td.*?>.*?<\/td>/i){ ($extract, $_) = /.*?<td.*?>(.*?)<\/td>(.*)$/i; push (@parsed_data, $extract); #print "$_\n\n"; } if (m/<td.*?>/i){ ($extract) = /.*<td.*?>(.*)$/i; $_ = ""; $td_switch = 1; #print "$_\n\n"; } } close(DAT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Remove new line characters
by graff (Chancellor) on Apr 18, 2007 at 06:11 UTC |