Are you saying 'H110704567.CRD' is your delimiter?? You want the data on
either side of that sequence?
split(/H\d{10}\.[A-Z]/ - will only match 'H110704567.C'
You need to split(/H\d{10}\.CRD/ or split(/H\d{10}\.[A-Z]{3}/
Sample data:
-----
This is field 1H110704567.CRDand this is field 2
-----
Would give you:
@chunks = ('This is field 1', 'and this is field 2');
Now, if you are really trying to parse out the numeric sequence, you want to
do a pattern match. Along the lines of (untested code):
-----
open (FILE, "rn410rpt.txt");
local $/ = undef;
my $whole_file = <FILE>;
while($whole_file =~ /H(\d{10}\).CRD/g)
{ print "RESULT: $1"; }
-----
RESULT: 110704567
Jeremy Elston
Sr. Staff Unix System Administrator
Charles Schwab & Co., Inc.
"The Jim Conspiracy IS real! You will be assimilated!"
http://www.geekcode.com
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d? s a? C++++ US+++ P++++$ L+> E--- W+$ N+
o K w+ O- M> V-- PS@ PE Y+ PGP t 5++ X@ R@ tv+
b+++@ DI++++ D+ G e* h-- r- z*
------END GEEK CODE BLOCK------
WARNING: All email sent to this address will be received by the Charles
Schwab Corporate email system and is subject to archival and review by
someone other than the recipient
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dave
Ball
Sent: Monday, March 08, 2004 8:18 AM
To: [EMAIL PROTECTED]
Subject: [Perl-unix-users] Confused about split
Hello, maybe someone can shed some light on a problem
I'm having. I'm trying to split a file into pieces
like the one listed below. What I key it on is
H110704567.CRD and it changes for each account. The
only thing that is consistent is the placement and it
begins with "H" followed by 10 digits and a 3 letter
extension.
I'm using the code below and no matter how I put it I
can never get the H110704567.CRD included in the
split. I tried parens as well too. When I finally get
it working there will be a loop that prints out all of
the elements.
Any help will be greatly appreciated!
open (FILE, "rn410rpt.txt");
while (<FILE>) {
local $/ = undef;
@chunks = split(/H\d{10}\.[A-Z]/, <FILE>);
print $chunks[0];
H110704567.CRD
1MISC-CREDITS
101 1107077467 Company 12-01-03 1
stuff
more stuff
MISC 138,412,674.24 19GT
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster http://search.yahoo.com
_______________________________________________
Perl-Unix-Users mailing list [EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs