RE: Reading from multiple sockets.

2008-10-21 Thread Kammen van, Marco, Springer SBM NL
-Original Message- From: Bob McConnell [mailto:[EMAIL PROTECTED] > Which I forgot to mention is that both my sockets are connected to > different ports... (54321 & 1024) > And also, one socket is connected to a server, and the other socket is > accepting from a client > Does this ch

XML::Simple question

2008-10-21 Thread Richard Lee
while trying to study the article on perlmonks.org, http://perlmonks.org/?node_id=490846 regarding XML parsing, I need bit of clarfication. how do I parse out http://www.oreilly.com/catalog/covers/perlbp.s.gif"; width="145" height="190" /> I tried $book->{image}->{src}... but d

Re: two questions on my perl exam.

2008-10-21 Thread birdinforest
Thanks for your suggestions and all of them make sense. However, since I am a totally beginner never learned programing, it should take me sometime to understand them clearly. I will also try to get answer from my lecturer, then post here that what I have learned from both questions. Programing

Send Mail with attachment

2008-10-21 Thread leolim818
Hi All, I'm using perl module MIME::Lite to sent out email with attachments, may I know what "Type" should I define to attach any type of files, for instance .jpg, .xls, .doc, .pdf and etc without checking the attached file type. Is there any global variable to define instead of Type => 'applicat

Re: Using a variable in a =~ match??

2008-10-21 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi all, Hello, Serious noob here (one week into llama 5th ed.). I'm trying to write a script to pull a specific file from a directory and search that file for specific phrases. I am having a problem searching for the file in the directory. If I type in the actual fil

Re: Using a variable in a =~ match??

2008-10-21 Thread Chris Charley
- Original Message - From: <[EMAIL PROTECTED]> Hi all, Serious noob here (one week into llama 5th ed.). I'm trying to write a script to pull a specific file from a directory and search that file for specific phrases. I am having a problem searching for the file in the directory. If I ty

how do I install perl into thumbdrive

2008-10-21 Thread itshardtogetone
Hi, I move around quite alot. So how do I install perl into my thumbdrive. I did a yahoo search and I found one but too technical == > http://www.perlmonks.org/?node=Portable+perl%3A+usb+thumbdrive Thanks

Re: using algorithm-permute

2008-10-21 Thread Rob Dixon
Sharanbr wrote: > On Oct 19, 6:38 am, [EMAIL PROTECTED] (Sisyphus) wrote: >> On Oct 17, 3:04 am, [EMAIL PROTECTED] (Sharan Basappa) wrote: >>> >>> #!/usr/bin/perl >>> use warnings; >>> use Algorithm::Permute; >>> my @array = (1..4); >>> Algorithm::Permute::permute { print "@array\n" } @array; >> >>

using Net::SSH::Expect within a thread fails

2008-10-21 Thread Andy Greenwood
Hello, I'm having problems with the following code. It is supposed to get a list of IP addresses from the IAD module and then create a few threads to each log into those devices and make changes in the config. The only device that is allowed to access the devices I'm configuring is the 'manage.exa

Re: last element during foreach loop

2008-10-21 Thread Rob Dixon
six24hourdays wrote: > On Oct 21, 11:06 am, [EMAIL PROTECTED] (Chas. Owens) wrote: >> On Tue, Oct 21, 2008 at 10:56, David Stiff <[EMAIL PROTECTED]> wrote: >>> >>> There probably is a better approach. >>> I am going through a list of Subversion branch names, e.g. >>> BRANCH_1 >>> BRANCH_1 >>> BRANC

Changing from FTP to Secure copy

2008-10-21 Thread Wagner, David --- Senior Programmer Analyst --- WGO
I am in the middle of moving from Solaris to Linux environment. On the current Solaris box, I use Net::FTP for all the work that needs to be done. On Linux, the ftp is not available, due to security concerns. The Linux environment had Perl at 5.8.0 and so I got the okay to bring down AS

Re: last element during foreach loop

2008-10-21 Thread six24hourdays
On Oct 21, 11:06 am, [EMAIL PROTECTED] (Chas. Owens) wrote: > On Tue, Oct 21, 2008 at 10:56, David Stiff <[EMAIL PROTECTED]> wrote: > > Hi Chas, > > > There probably is a better approach. > > > I am going through a list of Subversion branch names, e.g. > > > BRANCH_1 > > BRANCH_1 > > BRANCH_2 > > B

Re: last element during foreach loop

2008-10-21 Thread Dr.Ruud
"John W. Krahn" schreef: > six24hourdays: >> I would like to know how to test for the last element of a list >> during a foreach loop [...] > > You can't because a list does not have a name. [...] > You can however do it with an array by comparing references: > > $ perl -le' > my @x = "a" .. "z";

Re: Conserving memory

2008-10-21 Thread Dr.Ruud
"Mr. Shawn H. Corey" schreef: > kenTk: >> If I populate @array >> Then >> @array=(); >> Is the memory that was used for that array now freed? > > Yes, providing no other variable contains those items. For example: > > my @a = qw( a b c ); > my @b = @a; > @a = (); > > Since @b contains everything

Using a variable in a =~ match??

2008-10-21 Thread [EMAIL PROTECTED]
Hi all, Serious noob here (one week into llama 5th ed.). I'm trying to write a script to pull a specific file from a directory and search that file for specific phrases. I am having a problem searching for the file in the directory. If I type in the actual file name (line 26) I can find the phras

Re: Conserving memory

2008-10-21 Thread Chas. Owens
On Tue, Oct 21, 2008 at 11:08, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > On Mon, 2008-10-20 at 23:29 -0700, kenTk wrote: >> If I populate @array >> Then >> @array=(); >> Is the memory that was used for that array now freed? > > Yes, providing no other variable contains those items. For examp

Re: last element during foreach loop

2008-10-21 Thread John W. Krahn
six24hourdays wrote: Hello, Hello, I would like to know how to test for the last element of a list during a foreach loop, e.g. foreach $element (@List) { if (this is the last element) { do something } } What would I use for the IF condition? You can't because a list does n

Re: two questions on my perl exam.

2008-10-21 Thread John W. Krahn
birdinforest wrote: I am a student and enrolled Unix programing this semester. There are two questions relating to perl I can not work out in the last exam ( Actually I have write out my code, however the exam system marked it as "wrong"). Please help me to point out the fault. Thanks. QUESTION

Re: using algorithm-permute

2008-10-21 Thread Sharanbr
On Oct 19, 6:38 am, [EMAIL PROTECTED] (Sisyphus) wrote: > On Oct 17, 3:04 am, [EMAIL PROTECTED] (Sharan Basappa) wrote: > . > . > > > > > #!/usr/bin/perl > > use warnings; > > use Algorithm::Permute; > > my @array = (1..4); > > Algorithm::Permute::permute { print "@array\n" } @array; > > use warnin

Re: expect error

2008-10-21 Thread Juan Pablo Feria Gomez
> use strict; > use warnings; > use Expect; > use IO::Tty; > > $host = "192.168.1.72"; > $passwd= "xyz"; > $user = "xyz"; > > $t= "file.txt"; > my $connect = Expect->spawn("scp $t [EMAIL PROTECTED]:/work/$user/"); > $connect->expect(30,"\s") ||die "junk1"; > print $connect $passwd."\n"; Do you

Re: expect error

2008-10-21 Thread Sandeep Kumar
Chas. Owens wrote: On Tue, Oct 21, 2008 at 09:40, Sandeep Kumar <[EMAIL PROTECTED]> wrote: hi all, i am using expect module to connect to a remote server. i am getting the following error. Cannot sync with child: Interrupted system call at /perl_path/lib/Expect.pm line 134, somebody please

Re: last element during foreach loop

2008-10-21 Thread Chas. Owens
On Tue, Oct 21, 2008 at 11:06, Chas. Owens <[EMAIL PROTECTED]> wrote: snip > #open my $fh, "-|", "svn somehing" > # or die "could not run 'svn something': $!"; snip Whoops, that is what I get for going too fast. The multiple argument version is faster because it doesn't need to spawn a sub

Re: Conserving memory

2008-10-21 Thread Mr. Shawn H. Corey
On Mon, 2008-10-20 at 23:29 -0700, kenTk wrote: > If I populate @array > Then > @array=(); > Is the memory that was used for that array now freed? Yes, providing no other variable contains those items. For example: my @a = qw( a b c ); my @b = @a; @a = (); Since @b contains everything is @a, it

Re: last element during foreach loop

2008-10-21 Thread Chas. Owens
On Tue, Oct 21, 2008 at 10:56, David Stiff <[EMAIL PROTECTED]> wrote: > Hi Chas, > > There probably is a better approach. > > I am going through a list of Subversion branch names, e.g. > > BRANCH_1 > BRANCH_1 > BRANCH_2 > BRANCH_2 > BRANCH_3 > BRANCH_3 > BRANCH_4 > BRANCH_4 > > and checking to see

Re: last element during foreach loop

2008-10-21 Thread Mr. Shawn H. Corey
On Tue, 2008-10-21 at 10:55 -0400, Mr. Shawn H. Corey wrote: > if( @list ){ > my $last_item = pop @list; > for my $item ( @list ){ > # do stuff for all items but last > } > # do stuff for $last_item > } > If you want @list restored after you're done processing: if( @list ){ my $las

Re: expect error

2008-10-21 Thread Chas. Owens
On Tue, Oct 21, 2008 at 09:40, Sandeep Kumar <[EMAIL PROTECTED]> wrote: > hi all, > > i am using expect module to connect to a remote server. i am getting the > following error. > > Cannot sync with child: Interrupted system call at /perl_path/lib/Expect.pm > line 134, > > somebody please let me kn

Re: last element during foreach loop

2008-10-21 Thread Mr. Shawn H. Corey
On Tue, 2008-10-21 at 22:47 +0800, Jeff Pang wrote: > 2008/10/21 Chas. Owens <[EMAIL PROTECTED]>: > > > > > This is an odd desire; are you sure you really need to do this? Can > > you tell us what you are trying to achieve? Jeff's answer does what > > you want, but most likely there is a better

Re: two questions on my perl exam.

2008-10-21 Thread Chas. Owens
On Tue, Oct 21, 2008 at 10:43, Rob Dixon <[EMAIL PROTECTED]> wrote: snip snip > use strict; > use warnings; > > print join('', "@ARGV" =~ /[0-9]/g), "\n"; snip The perl interpreter in my brain throws a syntax error on the line 4 character 15. Since you have put your code out there here is mine

Re: last element during foreach loop

2008-10-21 Thread Jeff Pang
2008/10/21 Chas. Owens <[EMAIL PROTECTED]>: > > This is an odd desire; are you sure you really need to do this? Can > you tell us what you are trying to achieve? Jeff's answer does what > you want, but most likely there is a better approach to be using for > your actual problem. > Agree. He pro

Re: last element during foreach loop

2008-10-21 Thread Chas. Owens
On Tue, Oct 21, 2008 at 09:39, six24hourdays <[EMAIL PROTECTED]> wrote: > Hello, > > I would like to know how to test for the last element of a list during > a foreach loop, e.g. > > foreach $element (@List) { >if (this is the last element) { >do something >} > } > > What would I us

Re: two questions on my perl exam.

2008-10-21 Thread Rob Dixon
birdinforest wrote: > > I am a student and enrolled Unix programing this semester. > There are two questions relating to perl I can not work out in the > last exam ( Actually I have write out my code, however the exam system > marked it as "wrong"). Please help me to point out the fault. Thanks. >

RE: Reading from multiple sockets.

2008-10-21 Thread Bob McConnell
From: Kammen van, Marco, Springer SBM NL >>Hi All! >> >>I'm pretty new to working with sockets in perl, looked around for days >>for a proper solution for my IRC/DCC problem but couldn't find one. >> >>The connection to the server uses a socket with a neverending while >>loop: > >>All works fine

Re: two questions on my perl exam.

2008-10-21 Thread Chas. Owens
On Tue, Oct 21, 2008 at 08:49, birdinforest <[EMAIL PROTECTED]> wrote: > I am a student and enrolled Unix programing this semester. > There are two questions relating to perl I can not work out in the > last exam ( Actually I have write out my code, however the exam system > marked it as "wrong").

Re: $o->document vs $o->document()

2008-10-21 Thread Jay Savage
On Thu, Oct 9, 2008 at 6:04 AM, Peter Scott <[EMAIL PROTECTED]> wrote: > On Wed, 08 Oct 2008 04:59:19 -0700, John W. Krahn wrote: >> oldyork90 wrote: >>> I am using a module having documentation saying document() is a >>> method. However, I see it used as >>> >>> $o->document; >>> >>> Can you refe

eval, ualarm and IO::Socket

2008-10-21 Thread Deviloper
Hi there, I just wanted to ask if somebody has implementet an "nonblocking" socket reader, which uses Time::HiRes ualarm() function (or nativ perls alarm function) to break the "waiting on data in socket (if the socket has no data)" after a view microsecond... (in eval block) then do something el

Re: last element during foreach loop

2008-10-21 Thread Jeff Pang
2008/10/21 six24hourdays <[EMAIL PROTECTED]>: > Hello, > > I would like to know how to test for the last element of a list during > a foreach loop, e.g. > > foreach $element (@List) { >if (this is the last element) { >do something >} > } > my $i =0; for (@list) { if ($i == $#l

RE: Reading from multiple sockets.

2008-10-21 Thread Kammen van, Marco, Springer SBM NL
>Hi All! > >I'm pretty new to working with sockets in perl, looked around for days >for a proper solution for my IRC/DCC problem but couldn't find one. > >The connection to the server uses a socket with a neverending while >loop: >All works fine untill i want to make a DCC connection using anoth

last element during foreach loop

2008-10-21 Thread six24hourdays
Hello, I would like to know how to test for the last element of a list during a foreach loop, e.g. foreach $element (@List) { if (this is the last element) { do something } } What would I use for the IF condition? Thanks, Dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

two questions on my perl exam.

2008-10-21 Thread birdinforest
I am a student and enrolled Unix programing this semester. There are two questions relating to perl I can not work out in the last exam ( Actually I have write out my code, however the exam system marked it as "wrong"). Please help me to point out the fault. Thanks. QUESTION 1 Write a perl script

expect error

2008-10-21 Thread Sandeep Kumar
hi all, i am using expect module to connect to a remote server. i am getting the following error. Cannot sync with child: Interrupted system call at /perl_path/lib/Expect.pm line 134, somebody please let me know a solution for this. thanks, sandeep. -- To unsubscribe, e-mail: [EMAIL PROT

Re: Problem with Perl upload with $CGI::POST_MAX

2008-10-21 Thread Jeff Pang
2008/10/21 <[EMAIL PROTECTED]>: > > It's working fine with all type of files but except for file with the > image content. When the file with image content exceed the size limit, > it show the following error at internet explorer: > > "The page cannot be displayed > > Cannot find server or DNS Er

Reading from multiple sockets.

2008-10-21 Thread Kammen van, Marco, Springer SBM NL
Hi All! I'm pretty new to working with sockets in perl, looked around for days for a proper solution for my IRC/DCC problem but couldn't find one. The connection to the server uses a socket with a neverending while loop: sub connection { # Make The Initial Server Connection! # $con = IO::S

Problem with Perl upload with $CGI::POST_MAX

2008-10-21 Thread leolim818
Hi All, I try to upload file to my perl upload program and I have restricted the file upload with 100KB ($CGI::POST_MAX = 1024 * 100;), when a uploaded file exceed the size limit, an error message will be shown by calling $query->cgi_error(). It's working fine with all type of files but except fo

Conserving memory

2008-10-21 Thread kenTk
If I populate @array Then @array=(); Is the memory that was used for that array now freed? Similarly If I populate the anonymous array @{$arrayREFS[$index]} Then @{$arrayREFS[$index]}=(); Is the memory that was used for that anonymous array now freed? Thanks in advance -- To unsubscribe, e-ma