tags:

views:

255

answers:

2

Hello, I am reviewing some perl code and ran across this line

$> = $<;

It's older code and I wish I could have been more descriptive in the title above (sorry folks). What does this line do?

+16  A: 

It sets the effective user id to the real user id.

spig
`$>` is the effective user ID; `$<` is the real user id.
Matt Ball
So all actions will be done with privilege of user who executed the script
Ivan Nevostruev
Awesome! I knew you guys could help me through... Nikki
Nikki
@Ivan Yes. It's effectively ignoring the setuid bit for whatever follows.
EmFi
@Nikki reading the excellent documentation bundled with Perl also helps.
Sinan Ünür
@Sinan: I haven't checked, but this has to be in the docs. They are very good, and make up for some of the odd features in the language (like variables with names that are single, non-intuitive, punctuation marks).
David Thornley
+11  A: 

Spig is correct. There are a whole whack of other global variables whose name is only a symbol. You might find it useful to check perldoc perlvar for a list of them and what they mean.

EmFi