shadow52 wrote:
Hello Everyone,

Hello,

I have finally hit my max times of banging my head on the best way to
parse some data I have like the following below:

name = "Programming Perl"
distributor = "O'Reilly"
pages = 1077
edition = "2nd"
Authors = "Larry Wall
Tom Christiansen
Jon Orwant"

The last line is giving me some trouble

The last line there is:

Jon Orwant"


it has three newline seprators

That is not how "lines" are normally defined in Perl.


which stops me from being able to use a split function like the
following:

my ( $name, $distributor, $pages, $edition, $Authors ) = split( "\n",
$stanzas);

Why is all that data in $stanzas in the first place?


When I print them out I get the following:

name = "Programming Perl"
distributor = "O'Reilly"
pages = 1077
edition = "2nd"
Authors = "Larry Wall


So my last to authors are left out.

        last two authors


I have even tried a split like the following:

split( "(\"\$\n|\n", $stanzas); This still did work as I though it
would it seems I am just missing one little thing.


What I was hoping for is where on the net or in a book that I would
need to read to get this to work. I assume I will need to use a regex
in the split command I am hoping for a little guidance in the right
direction of where I need to go.

Show us how you got the data into $stanzas.



John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to