Hi,

Thanks for your help and the below suggested solution works only if we have
2 lines to swap. But I am trying out line swap for more than 2 lines.

Could you please help me on how to do it?

Input:

$sc:(.+)
<cit>(.+)
$tic:(.+)

Output:

$sc:(.+)
$tic:(.+)
<cit>(.+)

Note: Also the "reverse" command reverses the order and not works for the
above example.

Thanks and regards,
Sharmila

-----Original Message-----
From: Jeff Pang [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 14, 2006 4:58 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
beginners@perl.org
Subject: Re: Line Swap



>
>Input:
>
>$dc:[dot 1980]
>$su:UNITED STATES
>
>Output:
>
>$su:UNITED STATES
>$dc:[dot 1980]
>

You could read these input lines into an array,then call 'reverse' to do
that for you.
See 'perldoc -f reverse' please.
Also give an example here:

$ perl -e '@arr=qw/aa bb/;print join " ",reverse @arr'
bb aa

HTH.

--
Jeff Pang
NetEase AntiSpam Team
http://corp.netease.com





Confidentiality Notice: This transmittal is a confidential communication.  If 
you are not the intended recipient, you are hereby notified that you have 
received this transmittal in error and that any review, dissemination, 
distribution or copying of this transmittal is strictly prohibited. If you have 
received this communication in error, please notify this office immediately by 
reply and immediately delete this message and all of its attachments, if any.

Reply via email to