Hi Chris...

I tried like this...

INPUT = fopen("filename");
OUTPUT   -- I opend another file here to write output

while(<INPUT>) {
chomp @_;
@strings = split(@_, " ");
print OUTPUT strings[1] + strings[0];
}


But I got error msg...Can u modify this program if it is correct???

-----Original Message-----
From: Chris Devers [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 14, 2005 6:06 PM
To: Sreedhar reddy
Cc: beginners@perl.org
Subject: Re: I need help here

On Fri, 14 Oct 2005, Sreedhar reddy wrote:

> I am very new to PERL and I need a program to do following task. Can 
> [you] help me [please][question-mark]
>
>
> 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.

Yes, this is possible.

Have you tried anything so far?

You sent your message to beginners@perl.org and beginners-cgi@perl.org, 
but not [EMAIL PROTECTED] On the lists you 
wrote to, you need to take the effort to write at least some code, which 
we can then help you with.

Here's a hint, but it's intentionally incomplete:

   sub swap_columns {
     my ( $first, $second ) = @_;
     return ( $second, $first );
   }

You should be able to apply that to each line of input to generate each 
line of output. There's lots of other ways to go about this as well 
though, and if you provide some code we can help you work through it.


-- 
Chris Devers



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