try to split the lines like:
my ($var1, $var2,$var3,$var4) = split /:/, $line;  # for every line of file

than you can work with this as you like
or you can split into array or in hash like this $hash{w1}{w2}{w3}{w4} = 
anything to control
and than work with this hash
Hope it helps
Martin

Daniel Falkenberg wrote:

> 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]

Reply via email to