Solved

c++ > pERL

Posted on 2004-03-31
1
203 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now