perl - output not being displayed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting perl - output not being displayed
# 1  
Old 10-05-2011
perl - output not being displayed

Hi All

I have the following code

Code:
sub pall_nvrm {
my $cmd = `pall  -w "/u/ab/scripts/dev/nvrmerros/nvrmpaller"`;
print $cmd;
}

if i run
Code:
 
pall  -w "/u/ab/scripts/dev/nvrmerros/nvrmpaller"

in a shell i get this sort of out put
Code:
eagley:
boxted:
cadle:
eabost:
hales:
balcombe:
woking:
didsbury:
aughton:


but when run like above it does not return anuything, if it help pall is anotehr perl command, would i need to call this at the start of the script of sormthign ??

thanks

Last edited by Franklin52; 10-05-2011 at 06:18 AM.. Reason: Adding/Correcting code tags
# 2  
Old 10-05-2011
A silly question: Did you call the function pall_nvrm ?
# 3  
Old 10-05-2011
yup, using getSmiliept:long

i have this

Code:
GetOptions($OPT,
    "p"    => \&pall_nvrm,
        "h"     => \$help,
    "t"    => \&make_tea,

so i just do ./nvrm -p

( nvrm is the name if the prog)
# 4  
Old 10-05-2011
This way is working for me..

Code:
use Getopt::Long;

my $help;
sub pall_nvrm {
 print `/usr/bin/ls`;
}

GetOptions( 
		'p' => \&pall_nvrm,
		'h' => \$help,
		't' => \&make_tea
		) or die "Invalid usage!\n";

if( $help ) {
    print "Please have a look at the Getopt::Long documentation.\n";
}


O/P:
Code:
$ perl test.pl -p
cc_dbi
dbc
temp.txt
test
test.pl
$ perl test.pl -h
Please have a look at the Getopt::Long documentation.
$ 
$ 
$ perl test.pl -xxx
Unknown option: xxx
Invalid usage!
$

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed : Second field not getting displayed in the output

Hi , I have a file (input.txt) with the below contents : 20150223T12:00:25 hostnamex 20150716T10:40:54 hostnamey 20150202T20:08:03 hostnamez I want the output to be like below i.e excluding the timestamp ( THH:MM:SS) in the above file as follows : 20150223 hostnamex 20150716... (2 Replies)
Discussion started by: rahul2662
2 Replies

2. Shell Programming and Scripting

Perl help - how to assign output of perl to variable

Hi, guys, i have a script i inherited from a coworker but i'm not perl savy. The script works but i would like it to work better. I want to run this command ./ciscomgrtest.pl -r "show version" -h hosts.router and have the script goto each router in the hosts.router file and run the command... (2 Replies)
Discussion started by: whipuras
2 Replies

3. Shell Programming and Scripting

Perl : blank lines are displayed in the output after deleting few rows from excel

I am working on an assignment to pull all the records from excel sheet programatically and use the data for further calculations. In this process, I first defined 10 records in excel sheet and executed the below code. In the first run it is OK. But after deleting last few rows in excel sheet and... (0 Replies)
Discussion started by: giridhar276
0 Replies

4. Shell Programming and Scripting

Suppressing a message from being displayed

I have a script which checks for *.txt files in a particular directory and if no files were found then it goes into sleep for 10 secs and looks back for files again and if any files were found then the script does some processing with the files found, which is my requirement too. FILE_EXISTS=`ls... (5 Replies)
Discussion started by: vpv0002
5 Replies

5. Shell Programming and Scripting

Output file not displayed in the proper format

Hi am using uuencode fro attaching one report which is nothing but sql query output. But when i receive the report through attachement and when it is opened the report is not displayed in proper format. Means if the sql query has 100 rows the mail attachment report displays the report in 2... (2 Replies)
Discussion started by: weknowd
2 Replies

6. Shell Programming and Scripting

How to get following output in perl

Hi, I am new to perl. I am trying to write a perl program that will print out following output. 1:1 2:1,2 3:1,2,3 4:1,2,3,4 5:1,2,3,4,5 6:1,2,3,4,5,6 Script need to be written in for loop. Please help thanks -Lalit (1 Reply)
Discussion started by: email-lalit
1 Replies

7. Shell Programming and Scripting

Password is getting displayed

My shell script which runs on solaris has an execution in it. Contents of shell script BEGIN : Executable_filename username/password@DBinstance parameter2 parameter3 Contents of shell script END : When i launch the shell script, it connects to database to gets few details.. In the... (3 Replies)
Discussion started by: shafi2all
3 Replies

8. HP-UX

swlist is not displayed in HP-UX

Hi swlist command is not displayed in HP-UX ..it displays swlist: Command not found. uname -a HP-UX inccishh B.11.11 U 9000/800 4046719263 unlimited-user license :b: Best Regards vasanthan (4 Replies)
Discussion started by: vasanthan
4 Replies

9. UNIX for Dummies Questions & Answers

perl - file reading - last line not displayed

Hi, Here is something that am trying with perl #! /opt/third-party/bin/perl open(fh, "s") || die "unable to open the file <small>"; @ch = (); $i = 0; while( $content = <fh> ) { if( $i <= 5 ) { push(@ch, $content); $i++; } else { $i = 1; foreach(@ch) { (8 Replies)
Discussion started by: matrixmadhan
8 Replies

10. Solaris

hostname not displayed

Hi, I posted a problem earlier on on how to change IP addresses on an E450. I was able to work around this and wanna say thanks to all who assisted. But now on my server, I get this error, trying to configure hosts..RPC timed out. Also, when I type on the command line, hostname, nothing is... (7 Replies)
Discussion started by: Ronny
7 Replies
Login or Register to Ask a Question