Any one know how to set an alias in the perl, and use it after the perl script end

L

Lim kiang Leng

Any one know how to set an alias in the perl, and use it after the perl script end
 
A

Anno Siegel

Lim kiang Leng said:
Any one know how to set an alias in the perl, and use it after the perl
script end

You can't. The perl script runs as one process, the shell as another.
One process cannot set an alias for another.

You can use the shell's eval for a similar effect. The perl script
must print out the aliias definition:

print "alias boo echo boo boo BOO\n";

Saying

eval `perl_script`

will define the alias.

Anno
 
J

Joe Smith

Lim said:
Any one know how to set an alias in the perl, and use it after the perl script end

Shell aliases are held in the shell's private memory; perl cannot access it.

perldoc -q changed

-Joe
 
B

Ben Morrow

Quoth (e-mail address removed) (Lim kiang Leng):
Any one know how to set an alias in the perl, and use it after the perl script end

See perldoc -q environment.

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top