Hi all,
I am reading data from an HTML file, and puting this data into
an array.
One of the array values have three 'new line chars' that looks
like a 'square' in the HTML file itself.
It's an address field, so the value looks like this in the
file:
Address Line 1<square>
Address Line 2<square>
Address Line 3
When printed in the perl program, the array field looks like
this:
Address Line 1
Address Line 2
Address Line 3
I would like to extract the data, but it is proving difficult.
Here is the code I am using:
$line = $array_value;
$_ = $line;
/^(.?)\n/;
print $1.$2.$3."\n";
When I run the above script, I get "Address Line 1" printed.
When I replace the reg.ex. with /^(.?)\n(.?)\n/ in an attempt
to grab the second line, NOTHING is printed!
I also tried using the following code to remove the new line
characters, to no avail:
$line =~ tr/\015//;
$line =~ tr/\n//;
$line =~ tr/\r//;
Any help would be greatly appreciated.
Thanks!
I am reading data from an HTML file, and puting this data into
an array.
One of the array values have three 'new line chars' that looks
like a 'square' in the HTML file itself.
It's an address field, so the value looks like this in the
file:
Address Line 1<square>
Address Line 2<square>
Address Line 3
When printed in the perl program, the array field looks like
this:
Address Line 1
Address Line 2
Address Line 3
I would like to extract the data, but it is proving difficult.
Here is the code I am using:
$line = $array_value;
$_ = $line;
/^(.?)\n/;
print $1.$2.$3."\n";
When I run the above script, I get "Address Line 1" printed.
When I replace the reg.ex. with /^(.?)\n(.?)\n/ in an attempt
to grab the second line, NOTHING is printed!
I also tried using the following code to remove the new line
characters, to no avail:
$line =~ tr/\015//;
$line =~ tr/\n//;
$line =~ tr/\r//;
Any help would be greatly appreciated.
Thanks!