On Oct 14, 2005, at 7:22 AM, Sreedhar reddy wrote:


Hi,

I am very new to PERL and I need a program to do following task. Can u help
me pls.


I have a file with following contents.

454 NV_DS_DEFAULT_BAUDRATE_I
455 NV_DIAG_DEFAULT_BAUDRATE_I
516 NV_WCDMA_RX_LIN_VS_TEMP_I

I am expecting out put like

NV_DS_DEFAULT_BAUDRATE_I 454
NV_DIAG_DEFAULT_BAUDRATE_I 455
NV_WCDMA_RX_LIN_VS_TEMP_I 516

Basically it is interchanging of columns. Looking forward for your help.


This should help get you started....

<code>

#!/usr/bin/perl

use strict;
my $output;

my @record_list = ('454 NV_DS_DEFAULT_BAUDRATE_I',
                                '455 NV_DIAG_DEFAULT_BAUDRATE_I',
                                '516 NV_WCDMA_RX_LIN_VS_TEMP_I');
                                
for my $items(@record_list) {
                
        my ($number, $name) = split(/ /, $items);
                        
        $output .= "$name $number\n";
                
        }

print $output;

</code>

Kindest Regards,

--
Bill Stephenson
417-546-8390


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


Reply via email to