Perl equivalent of "case" or "switch" statements ?

2001-08-06 Thread jp
I've been searching through books and web resources but can't seem to find any reference to equivalent of "case" or "switch" statements in Perl. Is there such a thing in Perl? (Every reference to the word "switch" leads me towards things like -w etc.

RE: Perl equivalent of "case" or "switch" statements ?

2001-08-06 Thread jp
p $generic; # ... it *always* evaluated FALSE because of the 'return'. (DOH!) Thanks, -jp > -Original Message- > From: Bob Showalter [mailto:[EMAIL PROTECTED]] > Sent: Monday, August 06, 2001 8:28 AM > To: '[EMAIL PROTECTED]' > Subject: RE: Per

split up long string with spaces

2004-08-27 Thread JP
Zv8E /6yX" in this example I used 4 character groups, in reality it will be 40 characters or so. Any usefull hints are welcome. JP -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: split up long string with spaces

2004-08-27 Thread JP
Got it! $string =~ s/(\S{40}/\1 /g; does exactly the trick I need. now I wonder if it is possible to print the resulting spaced string without changing $string itself? do I really need a temporary variable or is it possible to do something like: print $string s/(\S{40}/\1 /g; "Jp&quo

Re: split up long string with spaces

2004-08-27 Thread JP
yeah, I think I will add the (?=.) Thanks "Mark Maunder" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > G'day. > > $string =~ s/(.{4})(?=.)/$1 /g; > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: split up long string with spaces

2004-08-27 Thread JP
break( $string, 4 ); > > sub break { > my $copy = shift; > $copy =~ s/(\S{$_[0]})/$1 /g; > return $copy; > } well I had hoped to save a temporary variable as well as create some more compact code ... nice hint anyway. Thanks, JP -- To unsubscribe, e-mail: [EM

screensaver prevention

2004-09-02 Thread JP
found several on CPAN, but which one is easiest to use for a simple task as this? JP -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: screensaver prevention

2004-09-03 Thread JP
windows of course I can ty my mobile phone to the mouse and call myself every few minutes. that way the mouse moves just a little bit by the vibration of the phone. but then agian, although it is fun aswell, I don't consider it wise to let my mobile lay around my office desk when n

Re: screensaver prevention

2004-09-03 Thread JP
ste.pl aborted due to compilation errors. "Jp" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Why not just change it in the system settings? > Because my administrator turned off the permissions to change te settings > > > > > If that's not

How to determine Operating System

2004-09-15 Thread JP
Perl being multiplatform, I need some function that returns something like SunOs 5.8 on Solaris 8 or Cygwin on Cygwin, Windows-XP on an XP host etc. to execute platform specific sub routines. Thanks! JP -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

indirect variables in string

2004-09-16 Thread JP
the following variables: $source = 'logfile'; $destination = 'logfile.0'; When I simply print the string the following appears on screen: Moving $source to $destination\n Whereas of course I actually wanted Moving logfile to logfile.0 Anyone know how to solve this? JP -- To

simple windows process list

2004-09-21 Thread JP
The object of the code below is to output a list of space seperated fields with PID, username and process. The code generates te correct output. My guess is that my perl code can be smaller. Who dares? #!perl # # Object: # To output a tab separated list of PID, username and process # for windows

Re: simple windows process list

2004-09-21 Thread JP
Don't worry guys, my other scripts are far more readable :-) JP "Bob Showalter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > JP wrote: > > The object of the code below is to output a list of space seperated > > fields with PID, username and pro

timezone issue with gettimeofday and localtime

2010-10-03 Thread JP
Hi all, I am having some trouble with time functions in Perl that correct their reading for the appropriate timezone. I have minimized my problem into the example script at the bottom of this message, where: 1. I print a microsecond resolution timestamp for the current time; 2. I read

Loading library different per Operating System

2011-06-11 Thread JP
x27;t locate /SerialPort.pm in @INC".\ How can I load a library depending on the platform I run on? Thanks! JP -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Win32::SerialPort COM4 doesn't claim to be a serial port

2011-06-11 Thread JP
I have a problem with my serial device on Windows, whereas it works fine on Linux. It works fine on Linux: use Device::SerialPort qw( :PARAM :STAT 0.07 ); $PortObj = new Device::SerialPort ($PortName, $quiet, $lockfile) || die "Can't open $PortName: $!\n$file_exists"; } I get an err

Re: CGI Images

2002-05-28 Thread JP Cartailler
Why don't you try to include the script using SSI (via .shtml) A good reference is here: http://httpd.apache.org/docs/howto/ssi.html#executingcommands i.e. when the page loads, the script will be executed and the image displayed. best JP www.cartailler.com "A. Rivera" &l