Thank You - all that have supplied me with a solution to the problem below.
I am amazed once again at the power of perl, I had imagined pages of code
and what do I receive? five line solutions! Absolutely Amazing.
My resolve has been strengthened to learn perl even more.
Thanks.

-----Original Message-----
From: Denham Eva [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 05, 2002 3:42 PM
To: BeginnersPerl (E-mail)
Subject: Regex Problem - please help


Hello Listers,

I am struggling to get this right. Beginner in perl, so please forgive
ignorance, but the regular expressions are confusing.

I am trying to read in a file, with content as follows
---snip---
1984 by George Orwell
A BEND IN THE RIVER by V.S. Naipaul
A CLOCKWORK ORANGE by Anthony Burgess
A DANCE TO THE MUSIC OF TIME (series) by Anthony Powell
A FAREWELL TO ARMS by Ernest Hemingway
A HANDFUL OF DUST by Evelyn Waugh
---end snip---
The idea is to list by Author ie.

George Orwell - 1984
V.S. Naipaul - A BEND IN THE RIVER 
Anthony Burgess - A CLOCKWORK ORANGE 
Anthony Powell - A DANCE TO THE MUSIC OF TIME (series) 
Ernest Hemingway - A FAREWELL TO ARMS 
Evelyn Waugh - A HANDFUL OF DUST

OK my code thus far is:-

--- Spin Code ---
open(INFILE,"books.txt")||die "Cann't Open";

while(<INFILE>) {
  $_ =~ m/[A-Fa-z0-9]/ || die "Sorry Don't Work"; # Here regex is for
everything
# But I would like to chop it up to divide Authors from Books
# Then to add them together with:- print "$author - $Book" -:for instance
# In the end to write the output to a seperate file.

  $index = $_;

  print $index;
}
--- Close Code ---
Now this produces a whole string, which I know, unfortunately I am not to
good with the regex part.

Any help will be much appreciated.

Denham Eva
Oracle DBA
In UNIX Land
On a quiet Night, you can hear the Windows machines reboot.


############################################################################
#########
This e-mail message has been scanned for Viruses and Content and cleared 
by MailMarshal
For more information please visit www.marshalsoftware.com
############################################################################
#########

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared 
by MailMarshal
For more information please visit www.marshalsoftware.com
#####################################################################################

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to