Hi,
Could any one tell me what is wrong with my code? It does not time out
after 5 seconds which is what i need. It remains in the infinit loop.
#! /usr/bin/perl
use strict;
use warnings;
sub comeOut;
$SIG{ALRM} = \&comeOut;
while (1) { };
eval
{
alarm 5; #timeout is 60
}
sub comeOut
On Dec 18, 9:07 am, dpchr...@holgerdanske.com (David Christensen)
wrote:
> Sooraj S wrote:
>
> > I have an array file_list which contains absolute/relative paths of
> > files. I want to remove duplicate elements and elements whose
> > filenames(not the path) are same.
Hi,
I have an array file_list which contains absolute/relative paths of
files. I want to remove duplicate elements and elements whose
filenames(not the path) are same. How can i do this using grep and
hash?
My code
===
my @file_list= qw(aaa ddd bbb/aaa ccc ddd kkk/ddd hhh);
my %exist=();
#To
Hi,
I have a file_list array containing paths to files. I want to delete
duplicate elements from an array. Also i want to delete files with
conflicting names ie those elements with same name but different path
should also be deleted. I want this to be done with grep.
my @file_list= qw(aa dd bb/aa
Hi,
Can i redirect the output to a file as well as stdout at the same
time...i dont want to use tee command..i want this to be done in my
perl program itself...
open STDOUT, '>' , 'log.txt'';
By including this in my perl program i can redirect my output to
log.txt. But i want my output to be dis
Hi I am new to perl.
I am trying to access a variable which is declared in a package. I
have kept both the files in the same directory. But still my code
errors out as ""$my_val" requires explicit package name".
my_file.pl
===
#!/usr/bin/perl
use strict;
use my_package;
prin
Hi Shlomi,
> Did you try looking at the shell's "$?" variable?
I've clearly mentioned that i am using the "$?" value to find out the
exist status through out my code.
>What do you mean by not exist?
In p3 u can see that my $file = "/hom/user/file";
I've given the location wrongly as a part of e
Hi,
In my perl script p1 i am calling another script p2 which logs into a
remote machine and executes a script p3. The $file defined in p3 does
not exist. So copy operation in p3 will error out with error code 256
and p3 stops execution with exit staus 256. But p2 is not able to
recieve this value
Hi,
My perl script internally calls some other scripts. The execution time
of the script is 5 min. I dont want any user to stop or suspend the
execution. ie I want my script to ignore the (ctrl+z) and (Ctlr+c)
By adding the following line to my script i was able to prevent user
from stopping my s
Thanks for your reply..
I have used all the standard headers. The only thing that am concerend
is that i want my array opt as an array of references.
@opt = (\$opt1,\$opt2,\$opt3);
When i iterate through the array, if it finds my condition to be
matched, it should set the value to 100, so that th
Hi,
My script has 3 options which recieve integers. If any of those
options are having a value which is less than zero i want to make them
to 100.
eg: if opt2 = 32 and opt3 = 24 i want to make them to 100.
code
=
our $opt1,$opt2,$opt3;
our @opt = (\$opt1,\$opt2,\$opt3);
GetOptions('opt1=i'
Hi,
My code is accepting an option "version" as an integer. If it is less
than 100, i need to add a zero in front of it so that i can do the
further processing.
Although this code is working, i am not sure that its the proper way.
if ($version < 100)
{
# convert an integer-variable to string
Hi,
I am using Getopt::Long to accept the command line arguments.
Logic
-
I have two mandatory options.
1.mod1_num
2.mod2_num
Both of them can accept either a 3digit number or another parameter
"preserve" which inturn accepts a 3digit number.
eg: my_script -mod1_num 123 -mod2_num 234
Hi,
I have a script which copies files from local machine to remote
machine.
parameteres : "-d" for directories, "-f" for files..
GetOptions ('d=s{,}' => \...@dir,
'f=s{,}' => \...@fil);
I want one more rename option "-r" which should be used only if "-d"
is specified ie only for dir
thanks for your reply...u mean to say this?
$t = Net::SSH::Perl->new("remote_1");
$t->login($uname,$paswd);
$t->cmd("ftp remote_2")
---
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
Hi,
I am using Net::SSH::Perl, Net::FTP to loginto remote machines...
I want to 'scp' some files in my local system to the remote machine
remote_1. After that, from the remote_1 i want to upload those files
to an FTP server, remote_2. I can access remote_2 only through
remote1. Please guide me on
Thanks for your help...It worked...My shell script prints properly...
At one stage it will prompt for user input
--
Mountpoint : Xpr23filesystem
Kernel : verified
P2P : katren"
OK to go : [y/n] ?
--
How to get the user in
Hi Chas Owens,
Thanks for your reply. I tried as you suggested. It prints the output
in the run time but the output is unformatted.
< 0x0: 77 6f 72 6b 2f 61 74 6c 61 6e 74 69 63 5f 6e 6f home/
shell_script
< 0x00010: 72 5f 72 65 6c 65 61 73 65 2e 63 73 68 5f 74 65
_newlone.csh_te
< 0x0
Hi,
I am using Net::Telnet module to login to a remote machine and to
perform a series of steps. In my script i am calling a shell script
which does some operations and takes almost 3 min to complete. I want
to redirect the output of that script to the console in run time, when
it is running. Is t
On Jul 15, 4:57 am, chas.ow...@gmail.com ("Chas. Owens") wrote:
> On Wed, Jul 14, 2010 at 10:16, Sooraj S wrote:
> > Hi I am very new to perl. I want to login to a remote machine and
> > check a directory exists or not.
>
> > my code:
> >
>
Hi I am very new to perl. I want to login to a remote machine and
check a directory exists or not.
my code:
using Net::Telnet;
$t = new Net::Telnet();
$t->open($remote_system);
$t->login($username, $passwd);
# this doesnot work.
if (-d $my_dir) { print "ready to go"; }
$t->close();
21 matches
Mail list logo