In article
<[EMAIL PROTECTED]>,
Chandrasekaran Mythili wrote:

> HI,
> 
> I am new to Perl and I need some help regarding tranfering the contents of
> one file to other file in specified format using perl.
> 
> the problem is i have one file with data(data is in hex) as follows:
> 48
> 30
> 20
> 2E
> 2E
> 2E
> 0
> 0
> 0
> 
> i want to copy the contents of this file to another file till 0 is
> encountered.that is i want the resultant file to have
> 
> 4830202E2E2E
> 
> what command should i use get all the data in the same line?

There is probably some subtlety of handling hexadecimal (just learned how to
add and subtract it yesterday) that I'm overlooking, but on the surface,
how about something as simple as:

while (<DATA>) {

    chomp;
    print;
    last if /^0$/;
}

print "\n";


-- 
Kevin Pfeiffer


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

Reply via email to