Hi,

Thanks for the code. When I execute it I have come across with compilation
errors. Have attached the perl and the error message for your information.

Please help me in this regard.

Thanks and regards,
Sharmila


-----Original Message-----
From: Raymond Raj [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 16, 2006 3:03 PM
To: [EMAIL PROTECTED]
Subject: RE: Line Swap



try attached program it'll swap last two lines


-----Original Message-----
From: sharmila [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 16, 2006 11:43 AM
To: [EMAIL PROTECTED]; beginners@perl.org
Subject: RE: Line Swap



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.

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.

Attachment: sch_cit.pl
Description: Binary data

Scalar found where operator expected at sch_cit.pl line 19, near ")
$tic"
        (Missing semicolon on previous line?)
Global symbol "$sc" requires explicit package name at sch_cit.pl line 18.
syntax error at sch_cit.pl line 18, near "$sc:"
Global symbol "$tic" requires explicit package name at sch_cit.pl line 19.
Execution of sch_cit.pl aborted due to compilation errors.

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