Hi all,
I am working on a regex that just won't do what it's told...
Basically I have a file like the following...
test1:x:26:testing1
test2:x:45:testing2
test3:x:45:testing3
test4:x:23:testing4
test5:x:45:testing5
Now I need to strip everything in there that is before the first ':' and
only match anything with the ':45'. I also need to be able to extract
everything past the last ':' and then store her in a hash like this...
%crud = {
'test2' => 'testing2',
'test3' => 'testing3', #Because these have 45 within them
:)
'test5' => 'testing5'
}'
Here is what I have so far...
$name_of_hash = "Crud";
open FILE ....
while (<FILE>) {
$keys_of_hash = $1 if /^\s*(.*?)\s*:/;
}
close FILE;
This is fine because it now finds the first part ie...
test1
test2
test3
test4
test5
Can some one give me some suggestions on where I would go next?
Regards,
Dan
==============================
VINTEK CONSULTING PTY LTD
(ACN 088 825 209)
Email: [EMAIL PROTECTED]
WWW: http://www.vintek.net
Tel: (08) 8523 5035
Fax: (08) 8523 2104
Snail: P.O. Box 312
Gawler SA 5118
==============================
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]