Solved

c++ > pERL

Posted on 2004-03-31
1
209 Views
Last Modified: 2010-03-04
hello..

i'm trying to transfered this c++ code to perl..
i heard that there's perl func that i can transfered this into 1 line of Perl..
-----------------------------------

int tmp = v.at(i);
v.at(i) = v.at(j);
v.at(j) = tmp;

----------------------------------
can any on suggest me?
Thx
TOm
0
Comment
Question by:tom_mk
1 Comment
 
LVL 20

Accepted Solution

by:
jmcg earned 500 total points
ID: 10729892
Perl has list assignments:

($a, $b) = ( $b, $a);

so you don't have to explicitly declare a temporary holding variable to do an exchange.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question