in reply to Re: Parsing with RegEx into Array
in thread Parsing with RegEx into Array
sub getItemsFromFile { local $/=undef; open IN_FILE, "< /tmp/.rss_download_file"; my $file_in = <IN_FILE>; close (IN_FILE); #$file_in="<item>headline1</item><item>headline2</item>"; my @allItems=(); #while ($file_in =~ m{<\s*item\s*>(.*?)</\s*item\s*>}g) while ($file_in =~ m{<item>(.*?)</item>}g) { push (@allItems, $1); print "$1\n";; } return @allItems; }
$file_in prints perfectly. It is there. This is UTF-8 character based file and it has foreign characters. If I uncomment the '#$file_in' line it works. Do u know why? The file is 33k bytes. Is it because I have '\n' In the file?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Parsing with RegEx into Array
by ikegami (Patriarch) on Jun 25, 2010 at 21:35 UTC | |
|