Hi,

The following could help you :


open (FILE, "input_test\.txt");

while (<FILE>){
        s/^\s*|\s*$//g;
        
        my @chars=split //;
        my @chunks=();
        
        while ( @chars ){
                push @chunks,join '', splice @chars,0,8;
        }       
        
        print join "\t",@chunks;
        print "\n"
}

close FILE; 


        Best regards,
        Steven Druyts
     Network and Operations, ASFOGM EMEA BE 
        Tel: +32-3-544-61-77
        mailto:[EMAIL PROTECTED] 
        Electronic Data Systems-Belgium NV,
        Noorderlaan 147, 2030 Antwerpen
        0426.836.523 RPR Mechelen 
        www.eds.be 
        This email contains information which is confidential and may be
privileged. Unless you are the intended addressee (or authorised to
receive for the addressee) you may not use, forward, copy or disclose to
anyone this email or any information contained in this email. If you
have received this email in error, please advise the sender by reply
email immediately and delete this email.


-----Original Message-----
From: thunder [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 19, 2008 4:24 PM
To: beginners-cgi@perl.org
Subject: parsing a line

Hello all

I have the following small file that i am parsing one line at a time
(each line consists of hex values)

line 1: 0d
line 2: 00000000
line 3: 00002000
line 4: 0064
line 5: 76d457ed462df78c7cfde9f9e33724c6 line 6: bded7a7b9f6d763e line
7: 0059010081bb300597603b6f90ef4421 line 8:
001608427754e957a0d281bb30059760 line 9:
a72f731c3be600000000000000000000


For line 5, for example, i want to break it up into chunks of 8 hex
charaters (ie for example 76d457ed, 462df78c etc).
I tried to use the shift operator (ie << or >>) but perl gives an error.

Any help with the above would be appreciated.

Thanks



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to