Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.


Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.


Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.


Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Commands & Shells

Use Perl inside Shell scripts

Submitted by on May 1, 2008 – 11:44 am 2 Comments

Perl is a far more powerful programming tool than any shell script. Sometimes you want to borrow some of that power without having to rewrite your entire shell script. There is an easy way to integrate Perl snippets inside your shell script.

In the following example we encapsulate a Perl script inside of a Korn shell function. The Perl script outputs the value of Perl $email variable. We then assign the value of this Perl variable to a shell variable by executing the function:

perl_email() {
/usr/bin/perl << 'EOF'
use EmailClient;
my $obj = EmailClient-new;
my $email = $obj-getData( -field = 'email' );
print "$email";
Print Friendly, PDF & Email


Leave a Reply

%d bloggers like this: