Re: print output on console at runtime

2011-07-27 Thread Irfan Sayed
can this be happen if command needs to be executed on remote machine and the output needs to be forked on the local console at runtime please suggest regards irfan From: Jim Gibson To: Perl Beginners Sent: Wednesday, July 13, 2011 12:00 PM Subject: Re: p

Any suggestion on how to "improve" this code? Malformed braces

2011-07-27 Thread newbie01 perl
Hi all, I've written a Perl script below that check and report for malformed braces. I have a UNIX ksh version and it took a couple of minutes to run on a 1+ lines. With the Perl version it only took about 20 seconds so I decided to do it the Perl way. Besides I need a similar thing for Window

Re: Exit subroutine on filehandle error

2011-07-27 Thread C.DeRykus
On Jul 27, 9:30 am, rob.di...@gmx.com (Rob Dixon) wrote: > ... > > Well, one thing I dislike about it is that it is using "or do {...}" > > instead of > > an "if ( ) { ... }". And I did mention something similar. > > What exactly is wrong with "or do {...}"? > > I believe it is the best option sim

Re: Add line feed to line

2011-07-27 Thread timothy adigun
Tim, >>check this if it answers ur #1 question: #!/usr/bib/perl -w $\="\n"; # with output record separator used you don't ve to use # $currentLine = $currentLine . "\x{0A}"; in ur code again my @arr=qw(item1 item2 item3); for(@arr){ print $_; # used $_ default argu

Re: Add line feed to line

2011-07-27 Thread Tim Lewis
I found an answer that I thought I would share. I am using ActivePerl on Windows server 2003. ActivePerl translates 0A as CR\LF. The print statement was causing the issue. To stop this, I added binmode to my file handle: open(OUTPUT,">$outputFileName"); binmode OUTPUT; It works great now.

Add line feed to line

2011-07-27 Thread Tim Lewis
I am attempting to add a line feed to the end of each line. When I do this, a carriage return is also added. My code lines are: $currentLine = $currentLine . "\x{0A}"; $finalOutput = $finalOutput . $currentLine; There has to be a way to do this. Also, is there a better way to concatentate? Th

Re: Wanted: Example of asynchronous bidirectional socket client (a socket chat program)

2011-07-27 Thread Jim Gibson
On 7/27/11 Wed Jul 27, 2011 10:07 AM, "siegfr...@heintze.com" scribbled: > Sorry if this appears twice. Since it bounced back to me -- probably > because of the HTML format -- I'm sending it again. > > I did some google searching and I could not find an example of a > bidirectional asynchronou

Wanted: Example of asynchronous bidirectional socket client (a socket chat program)

2011-07-27 Thread siegfried
Sorry if this appears twice. Since it bounced back to me -- probably because of the HTML format -- I'm sending it again. I did some google searching and I could not find an example of a bidirectional asynchronous socket client. A telnet client is an example of a bidirectional asynchronous socket c

Filehandling

2011-07-27 Thread Jihad Esmail
I know basic "filehandling". But are there any advanced techniques I should know when it comes to using a filehandle?

Re: Exit subroutine on filehandle error

2011-07-27 Thread Rob Dixon
On 27/07/2011 08:51, Shlomi Fish wrote: On Tue, 26 Jul 2011 16:58:47 +0100 Rob Dixon wrote: On 26/07/2011 16:39, Nikolaus Brandt wrote: On Tue, Jul 26, 2011 at 01:01:54PM +0300, Shlomi Fish wrote: Another option would be to use eval { ... } and $@ to trap exceptions: Thank you all for the

Re: Exit subroutine on filehandle error

2011-07-27 Thread timothy adigun
Hello Nikolaus Brand, You can try these: 1. ) Instead of "die" in your code use "warn", then return from the subroutine, 2.) Intstead of hard coding the path and file in your program i.e ["$basedir/$userdir/$outfile" ], ask the user to input the path and file, assign the input to a scalar and check

Re: Exit subroutine on filehandle error

2011-07-27 Thread Shlomi Fish
Hi Rob, On Tue, 26 Jul 2011 16:58:47 +0100 Rob Dixon wrote: > On 26/07/2011 16:39, Nikolaus Brandt wrote: > > On Tue, Jul 26, 2011 at 01:01:54PM +0300, Shlomi Fish wrote: > >> > >> Another option would be to use eval { ... } and $@ to trap exceptions: > > > > Thank you all for the replies. > > >