RE: Newbie Module Install question...

2002-06-05 Thread John Edwards

The answer is in your question...

http://www.roth.net/perl

The Win32::Daemon module is available from Dave Roth's site.

HTH

John

-Original Message-
From: Ron Powell [mailto:[EMAIL PROTECTED]] 
Sent: 05 June 2002 14:03
To: perl beginners
Subject: Newbie Module Install question...


So, I'm trying to use this script (which was mentioned in an earlier
submission to the list, I believe):

http://www.roth.net/perl/scripts/scripts.asp?DirMon.pl

I tried to do the following command:  perl DirMon.pl -?
And I get this error back:
Can't locate Win32/Daemon.pm in @INC (@INC contains: C:/Perl/lib
C:/Perl/site/lib .) at dirmon.pl line 21. BEGIN failed--compilation aborted
at dirmon.pl line 21.

So I checked the script and see this:

use Getopt::Long;
use Win32;
use Win32::Daemon;
use Win32::ChangeNotify;
use Win32::Perms;

So I tried to install the Daemon module using: perl -MCPAN -e install
Win32::Daemon

It error'd out, basically saying it couldn't find the module.  So.  I tried
searching for it at search.cpan.org... and it says, no modules found.

The question is...  How can I find the modules I need to run this script?
I'm not asking for the answer, but rather a pointer on how to find the
answer for myself.  I'm at a bit of a loss... I've actually managed to
install several modules on my own... 

BTW this is v5.6.1 built for MSWin32-x86-multi-thread


--
Ron Powell
Senior IT Analyst 
Network Administrator
gomembers, Inc. (Baltimore Office)
[EMAIL PROTECTED]
410-494-1600 x4058





--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Strange total from adding 2 numbers

2002-05-23 Thread John Edwards

No. I've just tried

---
$a = 68288455.49;
$b = 67947269.62;

$c = $a - $b;
print $c;
---

and also get a result of

341185.8699

Weird.

John

-Original Message-
From: Timothy Johnson [mailto:[EMAIL PROTECTED]] 
Sent: 23 May 2002 17:01
To: '[EMAIL PROTECTED] '; '[EMAIL PROTECTED] '
Subject: RE: Strange total from adding 2 numbers


 
It looks like the negative number is being entered as a string.  How are you
entering the second Acct_Bal_Raw variable initially? -Original
Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 5/23/02 8:47 AM
Subject: Strange total from adding 2 numbers

Why is the addition of the numbers -67947269.62 and 68288455.49, both with
only 2 numbers after the decimal, resulting in 341185.8696 where there
are 8 numbers after the decimal.  I would expect the number to simply be
341185.87.  How can i avoid this strange behavior?

Below are 2 examples, both are shown from the debugger.


  DB10 x $funds_type_totals{$funds_type}
0  68288455.49
  DB11 x $Deposit_Acct_Bal_Raw
0  '-67947269.62'
  DB12 s
161:  $Deposit_Acct_Bal_Raw +=  $funds_type_totals{$funds_type};
  DB12 x $Deposit_Acct_Bal_Raw
0  341185.8696


===

  DB18 $l = 68288455.49 -67947269.62

  DB19 x $l
0  341185.8699

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: FIle upload

2002-05-20 Thread John Edwards

agrh. sig from hell...

Post some example code. What platform are you running on? What webserver?
Have you got any error messages? How about the server logs? Is there
anything relevant there? Are you using the cgi.pm module?

John

-Original Message-
From: Arran [mailto:[EMAIL PROTECTED]] 
Sent: 20 May 2002 12:56
To: Perl Beginners List
Subject: FIle upload


I cant get a sucessfull file upload in ActivePerl i have tried many ways,,,

can someone send me a sucessfull example?


snip the sfh


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Logging details

2002-05-13 Thread John Edwards

You could either redirect all STDERR output to a file, or pass all error
info to a sub routine. For the second method you could do...

if (system ($cmd)) {
  fatalError(Error $!\n);
}  

sub fatalError {
my $error = shift;
open ERROR error.txt or die Can't append to error.txt: $!;
print ERROR $error;
close ERROR;
die \n;
}

John


-Original Message-
From: Shishir K. Singh [mailto:[EMAIL PROTECTED]] 
Sent: 13 May 2002 17:04
To: [EMAIL PROTECTED]
Subject: Logging details


Is there a better way of logging the details in a file. 

E.g. 

I would like the error message to go into a file instead of going to the
stderr

if (system ($cmd)) {
  die Error $!\n;
}  



I don't want to code the above as 

open (LOG, $logFile);
if (system ($cmd)) {
  print LOG Error $!\n;
  die;
}  


Any pointers!! 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: problem with directory listing

2002-04-11 Thread John Edwards

Whitespace, whitespace, whitespace. Right, got that over with now let's look
at your code (formatted so it's readable)

#!/usr/local/ActivePerl-5.6/bin/perl5.6.1 -w

use strict;
my $mw;
my $menubar;
my $algebra;
my @file_array;

my $dir_to_process = /home/rfell/mathprogram;

opendir DH, $dir_to_process or die cannot open $dir_to_process: $!;

foreach my $file (@file_array=readdir DH) {
if( -d $dir_to_process/$file ) { # You need to append the original
directory to the file from readir here
print $file is a sub-directory of $dir_to_process \n;
}
}

closedir DH;

HTH

John

-Original Message-
From: richard noel fell [mailto:[EMAIL PROTECTED]] 
Sent: 11 April 2002 13:07
To: [EMAIL PROTECTED]
Subject: problem with directory listing


Below is sample code that does not work as I intend, the intention being to
list all the sub-directories in a given directory.

#!/usr/local/ActivePerl-5.6/bin/perl5.6.1 -w

use strict;
my $mw;
my $menubar;
my $algebra;
my @file_array;

my $dir_to_process = /home/rfell/mathprogram;
opendir DH, $dir_to_process or die cannot open $dir_to_process: $!;
foreach my $file (@file_array=readdir DH){ if( -d $file){ print $file is a
sub-directory of $dir_to_process \n; } } closedir DH;

The  problem is that only . and .. are listed. No other sub-directories,
which are in fact there, are listed. I surely am missing something simple
here. Can anyone enlighten me? Thanks, 
Dick Fell

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: problem with directory listing

2002-04-11 Thread John Edwards

Sorry. That should have been prepend.

-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]] 
Sent: 11 April 2002 12:47
To: 'richard noel fell'; [EMAIL PROTECTED]
Subject: RE: problem with directory listing


Whitespace, whitespace, whitespace. Right, got that over with now let's look
at your code (formatted so it's readable)

#!/usr/local/ActivePerl-5.6/bin/perl5.6.1 -w

use strict;
my $mw;
my $menubar;
my $algebra;
my @file_array;

my $dir_to_process = /home/rfell/mathprogram;

opendir DH, $dir_to_process or die cannot open $dir_to_process: $!;

foreach my $file (@file_array=readdir DH) {
if( -d $dir_to_process/$file ) { # You need to append the original
directory to the file from readir here

snip


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Why it prints twice?

2002-04-04 Thread John Edwards

Try

$file=C:\\Program Files\\Apache Group\\Apache\\htdocs\\linux.htm;

open (IN, $file) or die Can't open $file: $!; # ALWAYS CHECK OPENS
while (IN) {
/a href=\(.+)\.+\/a/; # This will act on the value of $_ which you
are setting with while (IN)
print $1BR; # You can combine this into one line
}
close IN;

That may work. I'm not sure what was causing it to print the line twice. N.B
using regexs to play with HTML can bite you. Be warned. There are modules
that will do this sort of thing for you and to avoid any hairyness you
should consider using one of them.

HTH

John

-Original Message-
From: Octavian Rasnita [mailto:[EMAIL PROTECTED]] 
Sent: 04 April 2002 14:03
To: [EMAIL PROTECTED]
Subject: Why it prints twice?


Hi all,

I made the following script for parsing an html file and get the addresses,
but they are printed twice instead of only once each one. Do you have any
idea why?

Here is the script:

$file=C:\\Program Files\\Apache Group\\Apache\\htdocs\\linux.htm;
open (IN, $file);
while (IN) {
$line = /a href=\(.+)\.+\/a/;
print $1;
print br;
}
close IN;

I've made an .html file with a single address (link) to test the script, but
this script prints that address twice. It's just like when the script reads
each line twice.

Thank you for any help.


Teddy,
My dear email address is [EMAIL PROTECTED]



_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Opens / create file if necessary

2002-04-04 Thread John Edwards

Why open the file until enter has been pressed?

Try something like this

$file = c:/test.txt;

while (1) {
stuff;
}

sub stuff {
print Enter some text for the file (q to quit): ;
$input = STDIN;
print \n;

exit if $input eq q\n;

open FILE, $file or die Can't append to $file: $!;
print FILE $input; # You don't need a \n as it's not been stripped from
the input. And you should be using chomp, not chop for that.
close FILE;

print ##File contents are now:\n;

open FILE, $file or die Can't read from $file: $!;
print while (FILE);
close FILE;
print ##End of file\n\n;
}

HTH

John

-Original Message-
From: Bruce Ambraal [mailto:[EMAIL PROTECTED]] 
Sent: 04 April 2002 12:09
To: [EMAIL PROTECTED]
Subject: Opens / create file if necessary


Could you help I am not doing what I'm surpose to

With the code below I'm trying to do the following:
-Open a file, creating it  if necessary
-Print a name in file every time someone presses enter
-Print  a new line 
-Seek to the begining of file without closing file
-and print the file to STDOUT


--
#!/usr/bin/perl -w

open(INFILE,+inline) || die Could not open filename;
open(OUTFILE,+outline) || die Could not open filename;
 my $inline = STDIN; chop($inline);

  print OUTFILE $inline\n;
close(INFILE);
close(OUTFILE);



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: find files with .jpg extensions in directories

2002-04-04 Thread John Edwards

Take a look at this code I just found for the directory recursion

http://www.geodata.soton.ac.uk/~hrz/personal/perl_scripts/?link=view_source.
htmlscript=recurse.pl

For the second question, your until loop quits out as soon as the extension
is correct, leaving you with no input data. Try this instead

replace all of this

---
print Enter a file extension (e.g jpg): ;
chomp(my $extension = STDIN);
print \n;

until ($extension =~ /^[A-Za-z]{3}$/) {
print Please enter a three letter extension. E.g jpg
txt doc: ;
chomp($extension = STDIN);
print \n;
}
---

with this

---
my $extension;

do {
print Please enter a three letter extension. E.g jpg txt doc: ;
chomp($extension = STDIN);
print \n;
} until $extension =~ /^[a-z1-9]{3}$/i; # Numbers can be in a file extension
too. Make the regex case insensetive and you don't have to do A-Za-z
---

HTH

John

-Original Message-
From: Bruce Ambraal [mailto:[EMAIL PROTECTED]] 
Sent: 04 April 2002 14:49
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: find files with .jpg extensions in directories


Hi John 

Seems you're the only one around here.
also the prev solution(RE: Opens / create file if necessary) just worked
fine.

Help I'm struggling to have these two pieces of codes do
what I want it to do

With code (1)
I'm trying to recursively decends into directories to find
all the files that end in .jpg.

With code (2)
I'm trying to read in the extentionfrom the command line. 
 
---code(1) -
 #!/usr/local/bin/perl -w
# first example...

use strict;

# declarations...
my @files = `ls -F`;
my @jpegs;

my $extension = jpg;

foreach ( @files ){
next if /private/i;
chomp;

if(/\.$extension$/){
push(@jpegs, $_);
}
}

foreach (@jpegs) {
print $_\n;
}
-
 -code(2)

#!/usr/local/bin/perl -w
# first example...

use strict;

# declarations...
my @files = `ls -F`;
my @jpegs;

print Enter a file extension (e.g jpg): ;
chomp(my $extension = STDIN);
print \n;

until ($extension =~ /^[A-Za-z]{3}$/) {
print Please enter a three letter extension. E.g jpg
txt doc: ;
chomp($extension = STDIN);
print \n;
}

print Searching for *.$extension;

foreach ( @files ){
next if /private/i;
chomp;

if(/\.$extension$/){
push(@jpegs, $_);
}
}

foreach (@jpegs) {
print $_\n;
}






--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Strip Carriage Returns

2002-04-04 Thread John Edwards

How did you move the file? File copy? FTP?

*nix systems use line feeds at the end of lines in text files. Windows
systems use LF\CR. Or the other way round. That's the cause of your problem
anyway.

One way of solving it is to FTP the file to the box in asci mode, I believe.

This might help

http://www.google.com/search?sourceid=navclientq=Maybe+you+didn%27t+strip+c
arriage+returns+after+a+network+transfer%3F

John

-Original Message-
From: Glenn Cannon [mailto:[EMAIL PROTECTED]] 
Sent: 04 April 2002 15:06
To: [EMAIL PROTECTED]
Subject: Strip Carriage Returns


Not strictly a perl question, I know, but...
 
I have been writing and testing my perl script on a WinXP box, and I have
now moved it to its final home on a linux box.  When I run perl -c
scriptname, I get the following:
 
Illegal character \015 (carriage return) at index.pl line 2. (Maybe you
didn't strip carriage returns after a network transfer?)
 
Is there a simple way to prevent/cure this?
 
Glenn


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Array question...

2002-03-28 Thread John Edwards

try

if (defined @array) {
# do something
} else {
# It's not been created, do something else
}

HTH

John

-Original Message-
From: Michael D. Risser [mailto:[EMAIL PROTECTED]] 
Sent: 28 March 2002 13:55
To: [EMAIL PROTECTED]
Subject: Array question...


OK here's the problem:

I have an array that may or may not have been assigned to, if it has been 
assigned to I need to do one thing, otherwise I need to do something else.

I've tried many variations, but I'm having trouble determining if it has
been 
assigned to.

if(undef @myArray) {
# Do thing1
} elsif(!undef @myArray) {
# Do thing2
}

and

if ($myArray[0] ne ) {
# thing1
} else {
# thing2
}

as well as a few other variations. Printing out the array BEFORE the if
block 
shows nothing in the array, yet it does thing1.

After trying many different methods, I am totally lost, please help me!

TIA

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: search

2002-03-27 Thread John Edwards

http://www.m-w.com/home.htm

Oh, you mean in Perl?? Give more details. Are you looking for a word in a
file? In an input string?

$text = this is a test string;

if ($text =~ /test/) {
print Found 'text' in string;
}

John

-Original Message-
From: Allison Ogle [mailto:[EMAIL PROTECTED]] 
Sent: 27 March 2002 16:10
To: a a
Subject: search


Does anyone know how to search for a word?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: output graph to file

2002-03-26 Thread John Edwards

Try

open (FH, /www/html/images/graph.png) || die Could not create
/www/html/images/graph.png: $!; # Always check file opens
binmode FH; #  Set to binmode to prevent OS from mangling the data
print FH $gd_image-png();
close(FH);

HTH

John

-Original Message-
From: Conan Chai [mailto:[EMAIL PROTECTED]] 
Sent: 26 March 2002 12:07
To: [EMAIL PROTECTED]
Subject: output graph to file


Hi,

i want to ouput a graph image that i generated to a file but not quite sure
how to do it, below is what i have done.pls advise

Conan

..
..
..
use GD::Graph::bars;
my $graph = new GD::Graph::bars(800, 600);

my $gd_image = $graph-plot( \@data ); # @data contains x  y values for the
bar graph binmode FH;

open (FH,  /www/html/images/graph.png);
print(FH $gd_image-png);
close(FH);
..
..
...


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Batch creation of thumbnails

2002-03-26 Thread John Edwards

Try the GD module. Here is some code I have for creating thumbnails
(untested as it's stripped down from a bigger script). Thumbnails have a _
prepended to them. They're not great thumbs, there is no anti aliasing done
on them. For better image handling you'll need to look at the ImageMajick
(sp??) module but that's overkill for my needs.

use GD;

# Set new height of thumbnail
my $new_y = 120;

# Set path to files
my $directory = c:/image/folder;

# Collect file names here
my @files = qw(one.jpg two.jpg);

foreach $file(@files) {
thumbnail($file);
}

sub thumbnail {
my $file = shift;

return if -e $directory/_$file;

  print Generating thumbnail for $file\n;

# Load source image
my $srcImage = newFromJpeg GD::Image($directory/$file);

# Get image size
my ($orig_x,$orig_y) = $srcImage-getBounds();

# Calculate new image width based on fixed size of $new_y
my $new_x = ($new_y / $orig_y) * $orig_x;

# Create new object for thumbnail
my $thumb = new GD::Image($new_x,$new_y);

  # Copy the source image to the thumbnail image, resizing in the
process

$thumb-copyResized($srcImage,0,0,0,0,$new_x,$new_y,$orig_x,$orig_y);
  
# Save your thumbnail
open(OUT,$directory/_$file) || die Could not create
$directory/$file as thumbnail $directory/_$file: $!;
binmode OUT;
print OUT $thumb-jpeg();
close(OUT);

}

HTH

John

-Original Message-
From: Gary Stainburn [mailto:[EMAIL PROTECTED]] 
Sent: 26 March 2002 10:00
To: [EMAIL PROTECTED]
Subject: Batch creation of thumbnails


Hi all,

I need to be able to create thumbnails for a group of .jpg files overnight, 
and I was wondering if there were any perl modules that anyone could suggest

for this one?

I'm going to take a stroll over to CPAN, but I believe personal experiences 
always help.

-- 
Gary Stainburn
 
This email does not contain private or confidential material as it may be
snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Perl for Windows 98

2002-03-19 Thread John Edwards

Off the top of my head, DCOM is Distributed Component Object Model (or is it
method??). This, as I understand it, is used to access the OLE stuff in
Windows. You may already have the updated DCOM components on your machine.
If you don't then the Perl installer warns you I think. Looking back at the
Activestate site, it says that only Win95 machines need the DCOM update
although I beleive some Win98 machines (not 98SE) will need the DCOM update
as well.

As far as DCOM/OLE and Perl go, Dave Roth (http://roth.net/perl) is the
daddy. If you want to know more about it all, I suggest you join the Perl NT
Admins (http://www.perl-ntadmins.com/) mailing list and post a message about
it. You'll get some useful info from the guys there, including Dave Roth.

HTH

John

-Original Message-
From: Richard KHOO Guan Chen [mailto:[EMAIL PROTECTED]] 
Sent: 19 March 2002 03:45
To: [EMAIL PROTECTED]
Subject: RE: Perl for Windows 98


Er What is this DCOM?  I thought I did not see any mention of this in 
the ActiveState site.

I just downloaded (last night, in fact) and installed the Windows Installer 
from the ActiveState site and then successfully installed ActivePerl 5.6.1 
on my Windows98 Lite (Windows 98 with 95 interface). Works I think. Just 
tested it with the simple example.pl script.




At 04:26 PM 3/18/02 +, John Edwards wrote:
 From the requirements for ActivePerl 5.6

Windows 98

Microsoft Windows Installer 1.1+ (available from 
http://download.microsoft.com/download/platformsdk/wininst/1.1/W9X/EN-U
S/Ins
tMsi.exe)
Internet Explorer 5+ (available from http://windowsupdate.microsoft.com)
DCOM for Windows 98 (available from
http://www.microsoft.com/com/resources/downloads.asp)

HTH

John

-Original Message-
From: Johnson, Shaunn [mailto:[EMAIL PROTECTED]]
Sent: 18 March 2002 16:22
To: [EMAIL PROTECTED]
Subject: RE: Perl for Windows 98


--come on guys!  *lol*

--let me start from the beginning:
sometime ago, i asked for, and got,
perl training.  it was cool.  i got a
better understanding of what
was going on, methods, practical
application, etc ...

--the training was ON RedHat 7.2,
perl version 5.6.1.  so it's NOT that
i WANT to install it on Windows ... it's not
for me!  seriously!  would i let you
guys down like THAT? (answer: no)

--however, the other folks in the class
don't have access to the server so
readily.  some have to use their
laptops to get stuff done.  while they're
on the road, they can write a few things
and move it on the production server
with a few modifications.

--i have no control over what OS they
put on their laptops, but they did ask
for Perl for Windows (Windows '98 no less).

--so THAT is the *real* reason why i need
Perl for Windows.


-X


-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]]

Sure. They're called Windows 2000 and Linux

I wouldn't touch Win98 with a bargepole. Especially for developing on. 
As soon as you get a perl script that goes rouge and starts eating 
memory it will be much harder to kill off in Win98 than a proper OS.

You could always install the 5.22 version from activestate. It's hidden 
away in the older versions of perl section IIRC.

[snip]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed 
or used by any person other than the intended recipient.  Unauthorised 
use, disclosure or copying by whatever medium is strictly prohibited 
and may be unlawful.  If you have received this E-mail in error please 
contact the sender immediately and delete the E-mail from your system.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Perl for Windows 98

2002-03-18 Thread John Edwards

Sure. They're called Windows 2000 and Linux

I wouldn't touch Win98 with a bargepole. Especially for developing on. As
soon as you get a perl script that goes rouge and starts eating memory it
will be much harder to kill off in Win98 than a proper OS.

You could always install the 5.22 version from activestate. It's hidden away
in the older versions of perl section IIRC.

-Original Message-
From: Johnson, Shaunn [mailto:[EMAIL PROTECTED]] 
Sent: 18 March 2002 16:03
To: [EMAIL PROTECTED]
Subject: RE: Perl for Windows 98



--have explorer 5 ... but i have no idea
what DCOM is ... i'll have to look
into whatever that is ...

--aren't there any alternatives?

-X

-Original Message-
From: yahoo [mailto:[EMAIL PROTECTED]]

Hi,
a quick look on the ActiveState site seems to indicate that DCOM for win98
and atleast IE 5 are required.

Have you got these?

regards

Joel

-Original Message-

--howdy:

--i did download and install the, er,
installer 2.0 for windows '98 (it's called
InstMsiA).

--it installs and reboots the system,
but when i try to install ActivePerl 5.6.1
behind that, i get a messages that says
something like, 'Can't install'.

--i'm sorry i don't have the exact error message
to post ... but that's why i'm looking for
another version of Perl to install without the
pre-installer package.

-X

[snip rest]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Perl for Windows 98

2002-03-18 Thread John Edwards

From the requirements for ActivePerl 5.6

Windows 98

Microsoft Windows Installer 1.1+ (available from
http://download.microsoft.com/download/platformsdk/wininst/1.1/W9X/EN-US/Ins
tMsi.exe) 
Internet Explorer 5+ (available from http://windowsupdate.microsoft.com) 
DCOM for Windows 98 (available from
http://www.microsoft.com/com/resources/downloads.asp) 

HTH

John

-Original Message-
From: Johnson, Shaunn [mailto:[EMAIL PROTECTED]] 
Sent: 18 March 2002 16:22
To: [EMAIL PROTECTED]
Subject: RE: Perl for Windows 98


--come on guys!  *lol*

--let me start from the beginning:
sometime ago, i asked for, and got,
perl training.  it was cool.  i got a 
better understanding of what
was going on, methods, practical 
application, etc ...

--the training was ON RedHat 7.2,
perl version 5.6.1.  so it's NOT that
i WANT to install it on Windows ... it's not
for me!  seriously!  would i let you
guys down like THAT? (answer: no)

--however, the other folks in the class
don't have access to the server so
readily.  some have to use their
laptops to get stuff done.  while they're
on the road, they can write a few things 
and move it on the production server
with a few modifications.

--i have no control over what OS they
put on their laptops, but they did ask
for Perl for Windows (Windows '98 no less).

--so THAT is the *real* reason why i need
Perl for Windows.


-X


-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]]

Sure. They're called Windows 2000 and Linux

I wouldn't touch Win98 with a bargepole. Especially for developing on. As
soon as you get a perl script that goes rouge and starts eating memory it
will be much harder to kill off in Win98 than a proper OS.

You could always install the 5.22 version from activestate. It's hidden away
in the older versions of perl section IIRC.

[snip]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: URL Fetcher Java/Perl

2002-03-06 Thread John Edwards

I need a Java script

I have a java script

This is a mailing list for *Perl* CGI. Do you have a question relating to
Perl CGI? Would you like to share it with us?

John

-Original Message-
From: Fred Sahakian [mailto:[EMAIL PROTECTED]]
Sent: 06 March 2002 17:23
To: 
Subject: URL Fetcher Java/Perl


Dont ask but our servers dont support .SHTML extensions so I need a Java
script that can do some URL Fetching, or data fetching.  I have a java
script that works a bit, but can not handle carriage returns in the data
file, it will not print if a data file (the fetched document) has a carriage
return.  Anyone have experience with this sort of dilema?  


thanks.


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: popup_menu help

2002-03-06 Thread John Edwards

You can add some javascript code to the field's -onchange section.

-Original Message-
From: DUCHATEAU, GABRIEL [mailto:[EMAIL PROTECTED]]
Sent: 06 March 2002 17:34
To: [EMAIL PROTECTED]
Subject: popup_menu help


Hi all,

I hope somebody can help me here. I have a CGI script creating a popup menu
using  something like this


   print $query-popup_menu('menu_name',
['eenie','meenie','minie'],
'meenie');

Is there a way in perl to submit the form automatically once the user
selects a value from this popup_menu. Currently I have to use a submit
button but I would like to avoid this if it is possible.

Thanks 
Gabriel
 
 


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: delta time/date

2002-03-06 Thread John Edwards

Yeah, use the Date::Calc module or maybe Date::Manip.

John

-Original Message-
From: Dittrich G. Michael [mailto:[EMAIL PROTECTED]]
Sent: 06 March 2002 17:13
To: [EMAIL PROTECTED]
Subject: delta time/date


I try to find a quick and uncomplicated way to calculate the difference
between one and another date/time:

@date1 = ($year1, $month1, $day1, $hour1, $minute1);
@date2 = ($year2, $month2, $day2, $hour2, $minute2);

@deltaDateTime = difference(@date1, @date2);

print @deltaDateTime\n;
0 0 0 12 35

anyone any suggesting for a quick way ...and covering issues like 28Feb
30/31 month-length ...

(perl 5.005_3 on FreeBSD)

thanks in advanced


Michael G. Dittrich

--
berlin.de - meine stadt im netz. Jetzt eigene eMail-adresse @berlin.de
sichern!
http://www.berlin.de/home/MeineStadt/Anmeldung


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: some questions about for, foreach

2002-03-01 Thread John Edwards

I think it lies in the history of programming. Traditionally for loops look
like this (when written in perl)

for($i=1; $i=100; $i++){
   print $i\n;
}

while foreach loops look like this.

@array = qw(one two three);

foreach (@array) {
print $_\n;
}


Even though you can do

for (@array) {
...
}

and 

foreach($i=1; $i=100; $i++){
...
}

it's not the proper syntax. Yes, it works and there is no difference other
than stylistic between them, but I think traditionalists would work up a
froth if perl only had the for or foreach command supported. And, as the
saying goes, TIMTOWDI, and it wouldn't be perl without that ;)

OTOH I could be completely wrong :)

HTH

John

-Original Message-
From: Jon Molin [mailto:[EMAIL PROTECTED]]
Sent: 01 March 2002 15:09
To: [EMAIL PROTECTED]
Subject: Re: some questions about for, foreach


Jan Gruber wrote:
 
 Hi, Jon  list !
 On Friday 01 March 2002 11:29 am, you wrote:
  Hi list!
 
  I've always thought there's a difference between for and foreach, that
  for uses copies and foreach not. But there's no diff is there?
 
 AFAIK there's not really a difference between these two.
 
 It merely depends on your preferences, readable/maintanable code vs
 quick  dirty.

if there's no difference, what's the point of having both? I can't see
how readable/maintanable would increase by adding functions with the
same name, it'd rather increase the confusion...

is there really no diff?

/jon

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: TIMTOWDI Was: RE: some questions about for, foreach

2002-03-01 Thread John Edwards

Yeah, yeah. So I made a typo. :p

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 01 March 2002 18:00
To: [EMAIL PROTECTED]
Subject: TIMTOWDI Was: RE: some questions about for, foreach


It is really sad when people can't get their MLA
(Multi-Letter Acronym) correct!

It should be  TIMTOWTDI 

There Is More Than One Way To Do It

which is the Perl Hackers motto.

Good Luck!
Dennis

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Perl help

2002-02-27 Thread John Edwards

What format log file? What format spreadsheet? What OS?

-Original Message-
From: Allison Ogle [mailto:[EMAIL PROTECTED]]
Sent: 27 February 2002 14:42
To: [EMAIL PROTECTED]
Subject: Perl help


Hi,

I am a beginner trying to write a program which will read information from a
log file and write it to a spreadsheet for easier viewing and organization
but I'm not sure how to do this or how to get started.  ANY help would be
appreciatd.  Please respond to [EMAIL PROTECTED]  Thanks so much,

Allison


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Perl Equiv of URLEncode()

2002-02-27 Thread John Edwards

there is a function called escape() in CGI.pm which you can import. There is
also an unescape function.

use CGI qw(:standard escape);
#^ Import function

$text = This is a test $£#{}-+;
print Original text $text\n;

$escaped = escape($text);
print Escaped text $escaped\n;

HTH

John

-Original Message-
From: Lara J. Fabans [mailto:[EMAIL PROTECTED]]
Sent: 27 February 2002 16:57
To: [EMAIL PROTECTED]
Subject: Perl Equiv of URLEncode()


I'm being so braindead today.  This is probably one of the downsides of 
coding in multiple
languages.

What is the perl equivalent of PHP's URLEncode().  It encodes spaces to 
%20, etc.  I was looking
in CGI.pm, but couldn't find anything.  I know that there must be something 
out there.  The HTML::
module?  URI::??

I'm still reading through the stuff on CPAN, but was hoping for a kickstart 
to the brain.

Thank you in advance,
Lara
-
Lara J. Fabans
Lodestone Software, Inc
[EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Perl help

2002-02-27 Thread John Edwards

I have a script that I can send you which writes data from the NT eventlog
files into an Exel spreadsheet. I think this post belongs in the Perl
Beginners list, so I'm mailing it there.

Please post back to the list with your replies.

John

-Original Message-
From: Allison Ogle [mailto:[EMAIL PROTECTED]]
Sent: 27 February 2002 14:55
To: John Edwards
Subject: RE: Perl help


The log file is actually a *.dat file and I would be writing it to an Excel
spreadsheet.  I am on a Windows 2000 operating system.  You'll have to
forgive me because I don't know anything yet about Perl and I really need
help getting started.  Any help would be so greatly appreciated.

-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 27, 2002 9:42 AM
To: 'Allison Ogle'; [EMAIL PROTECTED]
Subject: RE: Perl help


What format log file? What format spreadsheet? What OS?

-Original Message-
From: Allison Ogle [mailto:[EMAIL PROTECTED]]
Sent: 27 February 2002 14:42
To: [EMAIL PROTECTED]
Subject: Perl help


Hi,

I am a beginner trying to write a program which will read information from a
log file and write it to a spreadsheet for easier viewing and organization
but I'm not sure how to do this or how to get started.  ANY help would be
appreciatd.  Please respond to [EMAIL PROTECTED]  Thanks so much,

Allison


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: iteration default variable

2002-02-27 Thread John Edwards

I don't think there is one. You can maintain a counter for this purpose
though.

my $counter;
for (@answer) {
#do something ...
print On element index $counter\n;
$counter++;
}

John (Ex OUP...)

-Original Message-
From: KAVANAGH, Michael [mailto:[EMAIL PROTECTED]]
Sent: 27 February 2002 16:26
To: '[EMAIL PROTECTED]'
Subject: iteration default variable


Hi there,

This is probably a simple one...

in a loop like this:

for (@answer) {
#do something ...
}


I understand that for each iteration of the loop, $_ contains the value of
$answer[current iteration].
But is there a default variable I can use to get the current index value?

Can't seem to find the answer anywhere... any ideas would be helpful.

Thanks everybody for contributing to this list... I find it useful.

Thanks
Mike Kavanagh




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: help to delete a line

2002-02-27 Thread John Edwards

You need to increment the counter *inside* that block as well. Otherwise,
$counter will remain 12 and you will go into an infinite loop.

if ($counter == 12) {
$counter++
next;
}
$counter++;

HTH

John

-Original Message-
From: Joanne Fearon [mailto:[EMAIL PROTECTED]]
Sent: 27 February 2002 17:20
To: [EMAIL PROTECTED]
Subject: help to delete a line


Hi,
I have a file that I am chopping and changing. I want to delete line 12
each time. I have a counter to tell the line number. Ive tried


if ($counter == 12)
{
next;
}
$counter++


this doesn't give an error but doesnt move on to the next line either.

thanks in advance for any help
Jo.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: sort order of hash keys

2002-02-26 Thread John Edwards

hash keys are stored unsorted. If you have the following hash

%test = (   one = 1,
two = 2,
three = 3);

and print out the hash key/value pairs.

foreach $key (keys %test) {
print $key is $test{$key}\n;
}

you will find they don't come out in the same order as they were stored.

You can perform a sort on the keys to arrange them in order

foreach $key (sort keys %test) {
print $key is $test{$key}\n;
}

or you can reverse the hash, making the values the keys, and sort on the new
keys

%reversed = reverse %test;

foreach $key (keys %reversed) {
print $key is $reversed{$key}\n;
}

In doing this though, you must be aware that you will lose any data that has
identical values. For example

%test = (   one = 1,
two = 2,
three = 3,
alpha = 1,
beta = 2,
gamma = 3);

%reversed = reverse %test;

foreach $key (keys %reversed) {
print $key is $reversed{$key}\n;
}

will print out

1 is one
2 is two
3 is three

There is probably another/better way of doing this using the comparison
operator =, but I don't know it. There is also a module available that
lets you store and retrieve hashes in a fixed order.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 26 February 2002 09:16
To: [EMAIL PROTECTED]
Subject: sort order of hash keys


hi


i would like to know if theres a smart way to unwind a hashtable so that
the key / value pairs comes out in the same order as they are in the table.

:o)

martin
-- 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: sort order of hash keys

2002-02-26 Thread John Edwards

This maybe...

Tie::LLHash.pm

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 26 February 2002 11:37
To: [EMAIL PROTECTED]
Subject: Re: sort order of hash keys


yeah, i new this was tricky.

my hash keys / values have uneven names so i cant use a sort routine
directly. thats why i would like to get the key / values in the same order
as they are in the hashtable file.

whats the name of that hash modules?

:o)

martin


On Tue, Feb 26, 2002 at 10:28:16AM -, John Edwards wrote:
 hash keys are stored unsorted. If you have the following hash
 
 %test = ( one = 1,
   two = 2,
   three = 3);
 
 and print out the hash key/value pairs.
 
 foreach $key (keys %test) {
   print $key is $test{$key}\n;
 }
 
 you will find they don't come out in the same order as they were stored.
 
 You can perform a sort on the keys to arrange them in order
 
 foreach $key (sort keys %test) {
   print $key is $test{$key}\n;
 }
 
 or you can reverse the hash, making the values the keys, and sort on the
new
 keys
 
 %reversed = reverse %test;
 
 foreach $key (keys %reversed) {
   print $key is $reversed{$key}\n;
 }
 
 In doing this though, you must be aware that you will lose any data that
has
 identical values. For example
 
 %test = ( one = 1,
   two = 2,
   three = 3,
   alpha = 1,
   beta = 2,
   gamma = 3);
 
 %reversed = reverse %test;
 
 foreach $key (keys %reversed) {
   print $key is $reversed{$key}\n;
 }
 
 will print out
 
 1 is one
 2 is two
 3 is three
 
 There is probably another/better way of doing this using the comparison
 operator =, but I don't know it. There is also a module available that
 lets you store and retrieve hashes in a fixed order.
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 26 February 2002 09:16
 To: [EMAIL PROTECTED]
 Subject: sort order of hash keys
 
 
 hi
 
 
 i would like to know if theres a smart way to unwind a hashtable so that
 the key / value pairs comes out in the same order as they are in the
table.
 
 :o)
 
 martin
 -- 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 --Confidentiality--.
 This E-mail is confidential.  It should not be read, copied, disclosed or
 used by any person other than the intended recipient.  Unauthorised use,
 disclosure or copying by whatever medium is strictly prohibited and may be
 unlawful.  If you have received this E-mail in error please contact the
 sender immediately and delete the E-mail from your system.
 
 

-- 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: convert array to integer

2002-02-22 Thread John Edwards

You want to take a sum of all the array elements??

You don't need to convert the array to an interger. Perl handles this
internally. For instance, if you want to treat a text string as a number, or
a number as a text string, perl allows it.

This does what you are after

use strict;
my @array = qw(5 6 7 8);
my $total;
foreach (@array) {
$total .= $_;
}

$total += 2;

print $total;

HTH

John

-Original Message-
From: kitti [mailto:[EMAIL PROTECTED]]
Sent: 22 February 2002 11:47
To: [EMAIL PROTECTED]
Subject: convert array to integer


how to convert array to integer

$array[0]=5
$array[1]=6
$array[2]=7
$array[3]=8

change to integer 5678 for calculate 5678+2=5680

thanks,


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: convert array to integer

2002-02-22 Thread John Edwards

$num=$num-0;

You don't need to do this in Perl. There is no distinction between an
integer and a string. It's just a scalar. OTThis is something you would
have to do in Javascript though./OT

John

-Original Message-
From: walter valenti [mailto:[EMAIL PROTECTED]]
Sent: 22 February 2002 12:12
To: kitti
Cc: [EMAIL PROTECTED]
Subject: Re: convert array to integer


kitti wrote:

how to convert array to integer

$array[0]=5
$array[1]=6
$array[2]=7
$array[3]=8

change to integer 5678 for calculate 5678+2=5680

thanks,

In not much elegant...

foreach(@array){
$num.=$_;
}

$num=$num-0;



Walter



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: file size

2002-02-22 Thread John Edwards

Upload via FTP? Via a web based form? 18 questions left...

John

-Original Message-
From: anthony [mailto:[EMAIL PROTECTED]]
Sent: 22 February 2002 14:22
To: [EMAIL PROTECTED]
Subject: file size


Hi,

I have an upload script, and i want to check the file size before it
uploads.

Any suggestion is appreciated

Anthony



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: [Q] Validating Forms?!

2002-02-21 Thread John Edwards

I would do this using javascript within the form. Then when the field loses
focus you can validate it. This means the form doesn't have to be submitted
before the user is alerted of a problem.

For extra robustness you can also validate the submitted results in the perl
script and return the user to the form with highlights on what is
wrong/missing.

HTH

John

-Original Message-
From: Bhanu Prakash [mailto:[EMAIL PROTECTED]]
Sent: 21 February 2002 10:59
To: [EMAIL PROTECTED]
Subject: [Q] Validating Forms?!


HI All,
  Is there a way to Validate the fields of a
form? Say I have a
text field, and I should show an error to the user if
he does not enter
anything while submitting the form?
Thanks for the help
Bhanu.



=
Bhanu Prakash G V S

__
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: [Q] Validating Forms?!

2002-02-21 Thread John Edwards

You might have more luck asking this in the Perl CGI Beginners list. I
haven't got any scripts that do this, but I know it's possible.

See http://learn.perl.org to subscribe to the CGI list.

John

-Original Message-
From: Bhanu Prakash [mailto:[EMAIL PROTECTED]]
Sent: 21 February 2002 11:12
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [Q] Validating Forms?!


John,
 Thanks much for that information. It would be of
great help to me if you can provide me with some
sample scripts that will do these functions.! 
Of course I'd like to add more robustness to my
script.! But, I don't know how to :(
Looking for your help
Bhanu.


I would do this using javascript within the form. Then
when the field loses
focus you can validate it. This means the form doesn't
have to be submitted
before the user is alerted of a problem.

For extra robustness you can also validate the
submitted results in the perl
script and return the user to the form with highlights
on what is
wrong/missing.

HTH

John

-Original Message-
From: Bhanu Prakash [mailto:[EMAIL PROTECTED]]
Sent: 21 February 2002 10:59
To: [EMAIL PROTECTED]
Subject: [Q] Validating Forms?!


HI All,
  Is there a way to Validate the fields of a
form? Say I have a
text field, and I should show an error to the user if
he does not enter
anything while submitting the form?
Thanks for the help
Bhanu.



=
Bhanu Prakash G V S

__
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]




=
Bhanu Prakash G V S

__
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Regular Expression

2002-02-21 Thread John Edwards

$req =~ s/\r//g ;
# This is replacing all carriage return special characters with nothing
globally.
# s/(replace)\r(carriage return special char)/(with nothing i.e delete
them)/g(globally. i.e for every match in the string, not just the first)/;

$req =~ s/([^\n]{72,72})\n([^\n]{1,71})\n([^\n]{1,71})$/$1\n$2$3/
# This regex appears to do nothing. It's looking for three matches, then
replacing them with the matches found. It's like saying look for all
instances of one two three in the string and replace them with one two
three. Although I could be wildly wrong on that. ;)

For more on regexes:
http://www.google.com/search?sourceid=navclientq=perl+regular+expressions

;)

HTH

John

-Original Message-
From: Lilian Alvarenga Caravela Godoy [mailto:[EMAIL PROTECTED]]
Sent: 21 February 2002 14:04
To: '[EMAIL PROTECTED]'
Subject: Regular Expression


Hi everyone

I am trying to learn Perl looking into some scripts.

One of them has a regular expression inside.

First of all, I need to know what two specific lines are doing. The code is
bellow.

$req =~ s/\r//g ;
$req =~ s/([^\n]{72,72})\n([^\n]{1,71})\n([^\n]{1,71})$/$1\n$2$3/

I know they are replacing some things but cannot understand what. Specially
the second one.

I would really appreciate if somebody could explain to me what that regular
expression means. It is kind of an emergency.

And, if someone knows a link where there is more information about regular
expressions, I would be grateful.

Thanks in advance.

Lilian



--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Global Constants in Perl ?

2002-02-19 Thread John Edwards

Yep. Use the constant function

http://perlhelp.web.cern.ch/PerlHelp/lib/constant.html

-Original Message-
From: Stephen.Hurley [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 17:31
To: '[EMAIL PROTECTED]'
Subject: Global Constants in Perl ?


Hi,

I was wondering if there was a way of defining global constants in Perl ? I
use strict to keep all my variables tidy. However, there are a number of
#define-like vars that I would like to keep all together at the top of my
files, so that they can be reconfigured by whoever maintains my code
(filenames and such). Since these won't need to be changed by the script...I
wanna make 'em constants. But I also don't want to have to keep passing them
around to subroutines (I want to them to be global). But I also would like
to use strict (which tends not to like global variables). Is there any
#define-like construct in Perl or am I asking for too much ? If so, what's
the next best thing ?

Steve.



/.
Stephen Hurley,
Room CS2-034,
IDC, University Of Limerick.

P. 087-6701459
E. [EMAIL PROTECTED]
A. Apt.10, Charlotte Q, Limerick City.

I'm not a conspiracy theorist, but there are people here who are trying to
make me look like one...

.../

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: help with html

2002-02-19 Thread John Edwards

I want to send an html document via email to people that have blocked html

Why? Can't you send a text file? What's special about this HTML page? Does
it contain links to web URLs? If so have you considered that they may not
have web access?

The main thing that I want this for is the ability to set the subject line
of a reply

??? Explain this in detail. Does the HTML page include a form which submits
to a remote perl script?

John

-Original Message-
From: Chris Zampese [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 11:48
To: perl list
Subject: help with html


This question probably belongs in the cgi list, but here goes...
I know that this is going to sound bad, but I want to send an html
document via email to people that have blocked html (I am doing a form for
an insurance broker, and it goes to the insurance companies that they deal
with.  The insurance companies have blocks on html) is there any way around
this problem (other than calling each insurance company and getting them to
change their settings, this is a problem as some of them are controlled by a
'head office' arrangement).  The main thing that I want this for is the
ability to set the subject line of a reply, so if anyone knows how to do
this another way that would work also,
   thanks for your time,
Chris.


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Sorted off list (was: help with html)

2002-02-19 Thread John Edwards

Just FYI, this was sorted off list. Chris, see what happens when you take
things off list...

John

-Original Message-
From: Chris Zampese [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 11:42
To: John Edwards
Subject: Re: help with html



Thanks John,
   I will rewrite my script so that it sends plain text and include the
link, plus instructions on what to do if the link does not work,
  Your help has been invaluable,

   many and varied thanks,

   Chris.


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Illegal seek

2002-02-19 Thread John Edwards

OK. Maybe I've missed something here, but why are you storing a single
string in an array??

Try this

$arg = $Basedir/ftpscr;
if (system($arg)) { die cannot execute ftpscr $!; }

John

-Original Message-
From: Tony McGuinness [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 14:55
To: Perl List (E-mail)
Subject: Illegal seek


Hi there,

I checked up on system and rewrote the line that
calls system. Now I have:

@args = ($Basedir/ftpscr);
system(@args) == 0 or die cannot execute ftpscr $!;

but the script is not executed. No errors are returned.

Any ideas?

Tony
=
DISCLAIMER

1. The information contained in this E-mail is confidential. 
   It is intended only for the stated addressee(s) and access 
   to it by any other person is unauthorised. 
   If you are not an addressee, you must not disclose, copy, 
   circulate or in any other way use or rely on the information 
   contained in this E-mail. Such unauthorised use may be unlawful. 
   If you have received this E-mail in error, please inform us 
   immediately and delete it and all copies from your system.

2. The views expressed in this E-mail are those of the author, 
and do not represent the views of AMT-Sybex Group Ltd., its 
associates or subsidiaries, unless otherwise expressly indicated.
In the avoidance of doubt, the insertion of the name of AMT-Sybex 
Group Ltd., its associate or subsidiary under the name of the sender 
may constitute an express indication that the views stated in the Mail 
are those of the named company.
=
For more information on the AMT Sybex group visit: http://www.amt-sybex.com 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Illegal seek

2002-02-19 Thread John Edwards

Sorry, I can't help with this issue. It was just something to try based on
your last post.

I've cc'd this back to the list. Please keep the discussion there.

Thanks

John

-Original Message-
From: Tony McGuinness [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 15:08
To: John Edwards
Subject: RE: Illegal seek


Hi John,

Thanks for the response.

I tried this to no avail.

The script I want to execute is executable.

Regards,

Tony

-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 14:55
To: 'Tony McGuinness'; Perl List (E-mail)
Subject: RE: Illegal seek


OK. Maybe I've missed something here, but why are you storing a single
string in an array??

Try this

$arg = $Basedir/ftpscr;
if (system($arg)) { die cannot execute ftpscr $!; }

John

-Original Message-
From: Tony McGuinness [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 14:55
To: Perl List (E-mail)
Subject: Illegal seek


Hi there,

I checked up on system and rewrote the line that
calls system. Now I have:

@args = ($Basedir/ftpscr);
system(@args) == 0 or die cannot execute ftpscr $!;

but the script is not executed. No errors are returned.

Any ideas?


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: How to count lines in an output file

2002-02-19 Thread John Edwards

open(INFILE, rmaccess1.txt) or die Can't open rmaccess1.txt: $!;
open(OUTFILE, outfile.txt) or die Can't create outfile.txt: $!;
# ALWAYS check for errors when opening file handles. It's a good habit to
get into.

print Enter name of the Media file to analyse: ;
# I'd keep the above on one line. Looks a little neater

chomp($realname = STDIN);

$counter = 0;
# Add this

while(INFILE) {

 if(/$realname/) {
  print OUTFILE;
  $counter++;
  # And add this
 }

}

# And finally do something with the new value of $counter
print $counter lines were saved to the output file\n;

HTH

John

-Original Message-
From: Tim Lago [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 14:31
To: [EMAIL PROTECTED]
Subject: How to count lines in an output file


I've written a really simple script that opens a file, reads for specific
line of text and copies the matches to an output file,

Here it is:

open(INFILE, rmaccess1.txt);
open(OUTFILE, outfile.txt);

print Enter the name of the Media file to analyze and press Enter: \n;

chomp($realname = STDIN);

while(INFILE) {

 if(/$realname/) {
  print OUTFILE;
   }

}

Now, I want to add another line that counts the number of lines that were
created in the outfile.txt, any help?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Size of Array

2002-02-18 Thread John Edwards

The terminology you are looking for is multidimensional array. I.e you have
an array wherin each element is an array (actually a reference to an
anonymous array IIRC), not a scalar.

You can find the size of the array by asking for it in a scalar context, not
a list context.

For example

my @array = qw(one two three four);
my $arraysize = @array;

print Array is $arraysize elements in length;

for a multidiemensional array

my @array = ([one, two, three], [four, five, six, seven]);

my $arraysize = @{$array[0]};
#   Here you are dereferencing the array referenced by $array[0]
into an anonymous array which is the enclosing @{}, then taking the scalar
value of it which gives you the number of elements in the second level of
the array

print First sub array size is $arraysize elements\n;

my $arraysize = @{$array[1]};

print Second sub array size is $arraysize elements\n;

HTH

John

-Original Message-
From: Agustin Rivera [mailto:[EMAIL PROTECTED]]
Sent: 18 February 2002 17:18
To: [EMAIL PROTECTED]
Subject: Size of Array


Thank-you to everyone who answered my last question.  As usually I am very
grateful for this group and the people in it.

Quick one.. is there a way to evaluate the size of an array?  Right now I'm
writing the arrays to a file and then doing an ls -l to compare sizes. The
array is of type $array[0][0] and not $array[0] (if anyone has the proper
terminology on this, I'd appreciate it).

Thanks,
Agustin Rivera
Webmaster, Pollstar.com
http://www.pollstar.com





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: $foo

2002-02-15 Thread John Edwards

lol. This should help explain.

http://whatis.techtarget.com/definition/0,,sid9_gci212139,00.html

When you see something like 

$foo = $_;

It means that someone is taking the value of the default variable ($_) and
assiging in to another scalar. In this case, $foo, but it could just as
easily be $someName.

The default variable is more often than not invisible in scripts. For
example

@array = qw(one two three);

foreach (@array) {
print;
}

In that code, then default variable appears twice. Can't see it?? That's
because most of the perl operators default to working with the default
operator if no other is assigned.

The code above does exactly the same as this

@array = qw(one two three);

foreach $_ (@array) {
print $_;
}

And if you want make it clear which variable you are working with you can do
either

@array = qw(one two three);

foreach $someName (@array) {
print $somName;
}

which assigns each element in turn to $someName or...

@array = qw(one two three);

foreach (@array) {
$someName = $_;
print $someName;
}

which assigns each element in turn to $_, then you are taking that value and
assiging it to $someName within the loop and working with that new value.

HTH

John

-Original Message-
From: Susan Aurand [mailto:[EMAIL PROTECTED]]
Sent: 15 February 2002 14:49
To: [EMAIL PROTECTED]
Subject: $foo


I am learning Perl, so this may seem a dumb question to the advance Perl
Programmers.
What exact purpose does $foo do?
Example $foo=$_. What benefit do I get  from making the input string
$foo? Every place I look I
do not get a clear understanding or picture of $foo.
Thank you
Susan



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Help me out

2002-02-15 Thread John Edwards

open(IN,'STNAMES.DAT') or die Can't open STNAMES.DAT: $!; # open student
consolidated names
open(OUT,'results') or die Can't create results: $!\n; # result file open
output

$counter = 1; # Use a better variable name than c. What does c stand for??
I'm assuming counter

foreach (IN) { # Now READ the contents of the IN filehandle, one line at a
time
# This next line looks like it could trip you up. Maybe a regex
would be better. Can you provide some sample lines from the input file??
$foo=substr($_,0,26);# strip out only the student last name and
first name.

# Next, you are not performing a loop here, but are using the while
operator. You would be better just checking for existence of the value.

if (exists($student{$foo}) {

# while(exists($student{$foo})){ # if the students is used already

$foo= $_$counter; # add the numer to it

# What are you trying to achieve here??
$_=$foo,substr($_,27,20); # add the remainder of the file back on to
input
string
$c++; # increment the number }


Sorry for jumping in halfway through this thread. Could you post *all* the
code you have so far, a sample of the input data and detail exactly what you
are trying to do? Maybe then we can help some more. Thanks

John

-Original Message-
From: Susan Aurand [mailto:[EMAIL PROTECTED]]
Sent: 15 February 2002 15:14
To: [EMAIL PROTECTED]
Subject: Re: Help me out


I took your advice and added the following code to my source code. I want to
print
the students name to the result
file regardless if I add a number on the end of the student name  or not. I
have
tried putting the PRINT O
at different location in this code. I can not get it to print to the result
file.
WHY and HELP!!
Thank You
Susan

 open(I,'STNAMES.DAT') or die$!; # open student consolidated names
 open(O,'results') or dieresults: $!\n;  # result file open output

 $c=1;

 $foo=substr($_,0,26);# strip out only the student last name and first
name.

 while(exists($student{$foo})){ # if the students is used already
$foo= $_$c; # add the numer to it
$_=$foo,substr($_,27,20); # add the remainder of the file back on to
input
string
$c++; # increment the number }








-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Perl regular expresions HELP!

2002-02-13 Thread John Edwards

foreach my $f ( @files ){
   # Iterate through the @files array, foreach iteration set the value of $f
to the next element of @files

if( $f =~ /private/ ){ next; }
  # If the scalar $f contains the text private, then stop this iteration
and move onto the next one

chomp $f;
  # Remove the newline character(s) from the $f scalar if present

$fil{$f} = 0;
  # Create or set the value of $f in the hash %fil to 0

# if we match the extension...
if( $f =~ /\.$extension$/ ){
  # If there is a matching extension after the last . in the value of $f

}
# if this isn't a directory name...
if( $f !~ /\\$/ ){ delete( $fil{$f} ); }
  # This should not work. (At least under Win32). Directory names do not
include the \
  # This code is checking for a \ at the end of the scalar value. e.g test\

}

You could rewrite to look like this

foreach ( @files ){ # Use the special $_ var to store each iteration
next if /private/i; # Stop this iteration if the value of $_
contains private, case insensitive
chomp; # Chomp defaults to $_ if not specified.
$fil{$f} = 0;
# if we match the extension...
if(/\.$extension$/){
# You need to add some code here...
}
# if this IS a directory - Surely you only want your list of files
to consist of file, not dirs?? - remove the entry from the %fil hash
if(-d $_) delete( $fil{$_} );
}

HTH

John

-Original Message-
From: Bruce Ambraal [mailto:[EMAIL PROTECTED]]
Sent: 13 February 2002 13:36
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Perl regular expresions HELP!


Please explain to me what this code does, here I'm tying to rename files
in current directory to 1.fil, 2.fil, ...

foreach my $f ( @files ){
if( $f =~ /private/ ){ next; }
chomp $f;
$fil{$f} = 0;
# if we match the extension...
if( $f =~ /\.$extension$/ ){
}
# if this isn't a directory name...
if( $f !~ /\\$/ ){ delete( $fil{$f} ); }
}

The complete program is:

#!/usr/local/bin/perl -w
# first example...

use strict;

# declarations...
my @files = `ls -F`;
my %fil;
foreach my $f ( @files ){
if( $f =~ /private/ ){ next; }
chomp $f;
$fil{$f} = 0;
# if we match the extension...
if( $f =~ /\.$extension$/ ){
}
# if this isn't a directory name...
if( $f !~ /\\$/ ){ delete( $fil{$f} ); }
}

Would some luv some assistance.

The struggling part is after having read current dir file into an array, I
now want to rename these files into current dir to 
1.fill, 2.fill, ...

PLEASE HELP!!!

THANK!
Bruce






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Printing values from hashes

2002-02-13 Thread John Edwards

Are you sure that $VALUE is recieving a value from the split?? If so your
code should print out the $VALUE value (you may want to pick some better var
names...)

John

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 13 February 2002 15:42
To: [EMAIL PROTECTED]
Subject: Re: Printing values from hashes


Hi I am new to hashes
Can somebody tell me why I can print $KEY but not $VALUE?

==
#!/usr/local/bin
open(GROUP, /etc/group) || die Cannot open:$!\n;
while(GROUP)  {
($KEY,$gpass,$ggid,$VALUE) = split(/:+/);
$HASH{$KEY} = $VALUE;
print the users in Group $KEY are $VALUE\n;


}
===

Thanks in Advance

Jaime Hourihane
CDC-IXIS
212.891.1935

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Perl regular expresions HELP!

2002-02-13 Thread John Edwards

foreach my $f ( @files ){
   # Iterate through the @files array, foreach iteration set the value of $f
to the next element of @files

if( $f =~ /private/ ){ next; }
  # If the scalar $f contains the text private, then stop this iteration
and move onto the next one

chomp $f;
  # Remove the newline character(s) from the $f scalar if present

$fil{$f} = 0;
  # Create or set the value of $f in the hash %fil to 0

# if we match the extension...
if( $f =~ /\.$extension$/ ){
  # If there is a matching extension after the last . in the value of $f

}
# if this isn't a directory name...
if( $f !~ /\\$/ ){ delete( $fil{$f} ); }
  # This should not work. (At least under Win32). Directory names do not
include the \
  # This code is checking for a \ at the end of the scalar value. e.g test\

}

You could rewrite to look like this

foreach ( @files ){ # Use the special $_ var to store each iteration
next if /private/i; # Stop this iteration if the value of $_
contains private, case insensitive
chomp; # Chomp defaults to $_ if not specified.
$fil{$f} = 0;
# if we match the extension...
if(/\.$extension$/){
# You need to add some code here...
}
# if this IS a directory - Surely you only want your list of files
to consist of file, not dirs?? - remove the entry from the %fil hash
if(-d $_) delete( $fil{$_} );
}

HTH

John

-Original Message-
From: Bruce Ambraal [mailto:[EMAIL PROTECTED]]
Sent: 13 February 2002 13:36
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Perl regular expresions HELP!


Please explain to me what this code does, here I'm tying to rename files
in current directory to 1.fil, 2.fil, ...

foreach my $f ( @files ){
if( $f =~ /private/ ){ next; }
chomp $f;
$fil{$f} = 0;
# if we match the extension...
if( $f =~ /\.$extension$/ ){
}
# if this isn't a directory name...
if( $f !~ /\\$/ ){ delete( $fil{$f} ); }
}

The complete program is:

#!/usr/local/bin/perl -w
# first example...

use strict;

# declarations...
my @files = `ls -F`;
my %fil;
foreach my $f ( @files ){
if( $f =~ /private/ ){ next; }
chomp $f;
$fil{$f} = 0;
# if we match the extension...
if( $f =~ /\.$extension$/ ){
}
# if this isn't a directory name...
if( $f !~ /\\$/ ){ delete( $fil{$f} ); }
}

Would some luv some assistance.

The struggling part is after having read current dir file into an array, I
now want to rename these files into current dir to 
1.fill, 2.fill, ...

PLEASE HELP!!!

THANK!
Bruce






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: finding .jpg or any .extention file

2002-02-13 Thread John Edwards

Try this...

#!/usr/local/bin/perl -w
# first example...

use strict;

# declarations...
my @files = `ls -F`;
my @jpegs;

print Enter a file extension (e.g jpg): ;
chomp(my $extension = STDIN);
print \n;

until ($extension =~ /^[A-Za-z]{3}$/) {
print Please enter a three letter extension. E.g jpg txt doc: ;
chomp($extension = STDIN);
print \n;
}

print Searching for *.$extension;

foreach ( @files ){
next if /private/i;
chomp;

if(/\.$extension$/){
push(@jpegs, $_);
}
}

foreach (@jpegs) {
print $_\n;
}

Been perling about 2 years. I am by no means an expert, but I like to help
out on this list when I can. Thanks for the support.

John

-Original Message-
From: Bruce Ambraal [mailto:[EMAIL PROTECTED]]
Sent: 13 February 2002 15:57
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: finding .jpg or any .extention file


Hey!!!

This man is really hot, he must be the man of the hour with more power.
thanks 
. and just for this last one modfication to the obove:

Now I need to read in the extension from the command line

John how long are you into perl?

Cheers
Bruce



 John Edwards [EMAIL PROTECTED] 02/13/02 05:32PM 
OK. Using the code from before

#!/usr/local/bin/perl -w
# first example...

use strict;

# declarations...
my @files = `ls -F`;
my %fil;

my $extension = jpg;

foreach ( @files ){ # Use the special $_ var to store each iteration
next if /private/i; # Stop this iteration if the value of $_
contains private, case insensitive
chomp; # Chomp defaults to $_ if not specified.
# This line isn't needed $fil{$f} = 0; #
# if we match the extension...
if(/\.$extension$/){
$fil{$_} = $_;
}
# if this IS a directory - Surely you only want your list of files
to consist of file, not dirs?? - remove the entry from the %fil hash
# if(-d $_) delete( $fil{$_} ); As we no longer create the hash pair
unless the file matches the extension this isn't needed either
}

foreach my $key (sort keys %fil) {
print $key\n;
}

Although, unless you do something more with the hash, you may be better off
storing the values in an array like this

#!/usr/local/bin/perl -w
# first example...

use strict;

# declarations...
my @files = `ls -F`;
my @jpegs;

my $extension = jpg;

foreach ( @files ){
next if /private/i;
chomp;

if(/\.$extension$/){
push(@jpegs, $_);
}
}

foreach (@jpegs) {
print $_\n;
}

HTH

John

-Original Message-
From: Bruce Ambraal [mailto:[EMAIL PROTECTED]] 
Sent: 13 February 2002 15:30
To: [EMAIL PROTECTED] 
Subject: RE: finding .jpg or any .extention file


Hi Jonh

I want to recursively find files in a directory that end in .jpg.
Would you assist with this one?

Cheers
Bruce



--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: finding .jpg or any .extention file

2002-02-13 Thread John Edwards

Why bother with reading the file in again and again??

Just do this

1)Open a file, create if necessary, read contents into @original array
2)Prints you name into the file every time someone presses enter, AND
appends to @original
3)Print a newline
4)Seek to the beginning of the file without closing the file NOT NEEDED
5)Print the file to STDOUT. NOT NEEDED, just print the contents of
@original. This is the data from the file, plus any new data that's been
added while the script was running.

HTH

John

-Original Message-
From: Bruce Ambraal [mailto:[EMAIL PROTECTED]]
Sent: 13 February 2002 16:18
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: finding .jpg or any .extention file


John
This is greater than great...
Thinks are getting to hot for me.
Thank again, I'll chat to you tomorrow, have to go...

In mean time  you may think about the this one, and don't tell me you got
this one too.

Goes like this:
1)Open a file, create if necessary,
2)Prints you name into the file every time someone presses enter,
3)Print a newline
4)Seek to the beginning of the file without closing the file
5)Print the file to STDOUT.

cheers for now and thank alot
Bruce


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Renaming files with Perl

2002-02-08 Thread John Edwards

http://www.google.com/search?sourceid=navclientq=perl+rename+file

HTH

John

-Original Message-
From: Troy May [mailto:[EMAIL PROTECTED]]
Sent: 08 February 2002 14:50
To: Perl Beginners
Subject: Renaming files with Perl


Hello,

I posted a question about this a couple days ago and only got 2 responses,
but neither of them worked for him.  So I figured I'd start new since he
told me the EXACT format he would like the files to be in.  My friend wants
to rename a dat file as he calls it.  (message.dat?)  He would like to
rename them in this exact format:  the word mess, current date (2
character format) then the extension .html.  So if he would run this today,
the renamed file would be:  mess020802.html

Any ideas on this?  He's really bugging me about it.  :)

Troy


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: How do I get trim or rounding on a float number ?

2002-02-08 Thread John Edwards

Well, do you want to round or trim? The number you mention rounded to 2dp
would be 25.00. Trimmed to 2dp would be 24.99.

To round the number you could do this

$number = 24.97;
$rounded = sprintf %.2f,$number;
print $rounded;

To trim you could do

$number = 24.97;
($rounded) = $number =~ /(\d*\.\d{2})/;
print $rounded;

John

-Original Message-
From: FLAHERTY, JIM-CONT [mailto:[EMAIL PROTECTED]]
Sent: 08 February 2002 14:48
To: Beginners (E-mail)
Subject: How do I get trim or rounding on a float number ?


$ aver = $total_hours/$total_jobs
 
 
some times comes up with   24.97  . I would like to round or trim to
24.99 for example .  any Ideas  ??
 
 
thanks 
Jim F
 


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: How do I get trim or rounding on a float number ?

2002-02-08 Thread John Edwards

Ah. Reading this I realised that while the number you gave (24.97) will
round to 25.00 using sprintf, not all number will round as expected using
that methos. Instead you can use this (which does appear to work).

$number = 12.345; # Round this number
$n = 2; # to this many places
$rounded = int($number * (10 ** $n) + .5) / (10 ** $n);
print $rounded;

HTH

John

-Original Message-
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]]
Sent: 08 February 2002 15:01
To: FLAHERTY, JIM-CONT
Cc: Beginners (E-mail)
Subject: Re: How do I get trim or rounding on a float number ?


On Feb 8, FLAHERTY, JIM-CONT said:

some times comes up with   24.97  . I would like to round or trim to
24.99 for example .  any Ideas  ??

  perldoc -q round

will tell you about whether or not Perl has a rounding function.

If you're REALLY worried about whether 12.345 rounds to 12.34 or 12.35,
then you should use a specific rounding function, but if not, you can use
sprintf():

  $num = sprintf %.02f, $raw;

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for Regular Expressions in Perl published by Manning, in 2002 **
stu what does y/// stand for?  tenderpuss why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Never had this happen before!

2002-02-07 Thread John Edwards

Magic??

Why don't you start by posting the errors that perl reports. It will save us
having to guess...

John

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 07 February 2002 15:42
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Never had this happen before!


My program won't compile when the sub routine is in the program,  
but when I remove it from the program and put it into another file
that I call test.pl, and compile test.pl which contains only the sub
routine I'm checking, it compiles fine!

Why does it do that?



--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: HELP! : To write a script that reads numbers from STDIN and print on STDOUT.

2002-02-07 Thread John Edwards

Yeah. I can write code to do that. Thanks for asking.

This has the hallmarks of a homework assignment...

John

-Original Message-
From: Bruce Ambraal [mailto:[EMAIL PROTECTED]]
Sent: 07 February 2002 16:31
To: [EMAIL PROTECTED]
Subject: HELP! : To write a script that reads numbers from STDIN and
print on STDOUT.


Hi ALL

Could  any one write some coding for the following problem.

In perl against Linx could someone help.

---
I want to write a script that reads in four numbers from STDIN and add the
first two together, and than adds the second 2 together.
The input format is a number on a line.(press enter after every number)
I also want to ompare the resulting two numbers with  or  and print the
largest on STDOUT.



I have a second part to the previous problem.

I now want to modify the script to read a name, and then the number
(again each on its own line)
To read four name/number pairs
To read two names from STDIN and add the associated numbers together.
Repeat this step.
Then to compare the resulting two numbers with
 or  and print the largest on STDOUT.

Thanks in advance

Bruce


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Newbe looping questions

2002-02-05 Thread John Edwards

You are right to use the while loop. However, if you are continually running
the same command and storing that value in $foo, how can you expect it to
change? Does the external program change it's return value?

Can you explain in more detail what you are trying to achieve.

This example shows how the while loop will halt.

$bar = 10;

while ($foo = $bar) {
print $foo\n;
$foo++;
}

HTH

John

-Original Message-
From: Mark Richmond [mailto:[EMAIL PROTECTED]]
Sent: 05 February 2002 03:50
To: [EMAIL PROTECTED]
Subject: Newbe looping questions



How do I loop until the value of variable changes?
In this example at some point the value of $foo 
will change and I can continue
It seems that I need to re-eval the value some how 


$bar = foo ; 
$foo = qx(os_cmd); # sets $foo to foo 

while ($foo eq $bar) {
$foo = qx(os_cmd); 
print Print loop forever \n;
}

This just loops forever It never sees that the value 
of $foo because it's in the loop. What an I missing 

-mark


- 
Mark Richmond [EMAIL PROTECTED] 
Airvana Inc. 
25 Industrial Ave. 
Chelmsford, MA 01824 
Voice: 978-250-2669 
Fax:   978-250-3910 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: to know about new computer h\w

2002-02-05 Thread John Edwards

www.google.com

Stop wasting our time and bandwidth. That post was so off topic, badly
worded and misconceived that your thanking you comes across as pure
sarcasm...

John

-Original Message-
From: sanilkumar [mailto:[EMAIL PROTECTED]]
Sent: 05 February 2002 10:01
To: [EMAIL PROTECTED]
Subject: to know about new computer h\w 



i want to present a seminar on new computer hardwares next week.
i want to know the technical details of various newly developed
computers.please send me text only if possible.
thanking you,



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: distinguishing positive and negative values

2002-02-05 Thread John Edwards

This should work. I've used an array to simulate your text files. The first
regex (as you already had) matches the lines without a - sign. I've modified
your second regex to look for the - sign, thus it picks up negative values
only.

@array = (3034364717283459322a-15.32zM042001H,
3045434551648534245a243.56zM040532H,
3053232540927543293a-2.45zM040332H);

foreach (@array) {
print Positive $_\n if /a([\d.]+)z/;

print Negative $_\n if /a-([\d.]+)z/;
}

HTH

John

-Original Message-
From: Stuart Clark [mailto:[EMAIL PROTECTED]]
Sent: 05 February 2002 11:25
To: Perl List
Subject: distinguishing positive and negative values


Hi,
 
How do I distinguish between positive and negative values.
This is part of a merchant batch script.
The values are between the a and z
I want to make the refunds (negative values) go to one file
And the sales (positive values) got to another
 
Regards
Stuart Clark
 
 
# start of file test
3034364717283459322a-15.32zM042001H
3045434551648534245a243.56zM040532H
3053232540927543293a-2.45zM040332H
# end of file test
 
open (IN,test)  ||  die Could not open the test file\n;
open (OUT,output_positive)  || die Error could not create the
output file\n;
open (OUT2,output_negative)  || die Error could not create the
output file\n; 
 
while (IN) {
 
print OUT if /a([\d.]+)z/; # this bit needs to determine the positive
values
 
print OUT2 if /a([\d.]+)z/; # this bit needs to determine the negative
values
 
}
 
close(IN)   || die Error cannot close test file\n;
close(OUT)|| die Error cannot close output file\n;
 close(OUT2)|| die Error cannot close output2
file\n;
 
# output_positive file must look like this
3045434551648534245a243.56zM040532H
 
# output_negative file must look like this
3034364717283459322a-15.32zM042001H
3053232540927543293a-2.45zM040332H
 


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: select text

2002-02-05 Thread John Edwards

You can use the following code...

$email = 'Name LastName [EMAIL PROTECTED]';
$email =~ /([\w@.]+)/;
$email = $1;
print $email;

As you seem relatively new to this, here is a breakdown

$email = 'Name LastName [EMAIL PROTECTED]';
# Just define the data for this demo

$email =~ /([\w@.]+)/;
# This is a regular expression which looks for a left angle bracket 
# Followed by either []
# a word character \w
# or an at sign @
# or a full stop .
# Look for at least one of each of these, but more if possible +
# Save the stuff you find using this criteria in the special variable ()
# But don't look past the right angle bracket

# Hopefully that makes some sense ;)

$email = $1;

# Now store the data that was matched and stored in the special variable $1
back into the $email var

print $email;
# You know this one, right ;)

HTH

John

-Original Message-
From: Roman Fordinal [mailto:[EMAIL PROTECTED]]
Sent: 05 February 2002 17:11
To: [EMAIL PROTECTED]
Subject: select text



  i need get e-mail adrees from string
  
  $email=Name LastName [EMAIL PROTECTED]
  to
  $email=[EMAIL PROTECTED]

  why get it  :

:
:. s pozdravom
:..  Roman Fordinal
:..  project manager
:.:
:.: WebCom s.r.o. - Internet Advertising Agency  Design Studio
:.: Stanicna 12, Zohor, Slovakia
:.: Tel: +421.02.65458251, +421.0907.178147
:.: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: select text

2002-02-05 Thread John Edwards

  Give a man a fish and you feed him for a day.
   Teach a man to fish and you feed him for a life time.
  
  -Chinese proverb

This is a beginners list, no? I thought we were here to help people learn,
not provide them with solutions that may work, but they don't know how...

John

-Original Message-
From: Jonathan E. Paton [mailto:[EMAIL PROTECTED]]
Sent: 05 February 2002 17:19
To: [EMAIL PROTECTED]
Subject: Re: select text


 --- Roman Fordinal [EMAIL PROTECTED] wrote:
 
   I need to get the email address from string:
   
   $email=Name LastName [EMAIL PROTECTED]
 
   How do I extract it?  [Above converted to English -
JEP]

($email = $email ) =~ /\([^]+)\$/;

Jonathan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Checking if a file exists.

2002-02-04 Thread John Edwards

$file = /path/to/file.txt;

if (-e $file) {
print Yep, that file exists\n;
} else {
print Nope. Not there\n;
}

For more on the file test operators see perldoc -f -X

HTH

John



-Original Message-
From: Ned Cunningham [mailto:[EMAIL PROTECTED]]
Sent: 04 February 2002 14:47
To: '[EMAIL PROTECTED]'
Subject: Checking if a file exists.



Please help.

I need to check if a files exists in the root of c.  I would like to use if
else to control the response.  I have tried to check the file and verify $!,
but it seems to give me a problem.

Can anyone help?

#!/usr/bin/perl
 $sysname = `hostname`; 
 $nsname = substr($sysname,0,5);
 $tname = shop1;
 $ttname = shop2;
 $syroot = shop1\\c\\loadvast.txt;

  if ($nsname eq $tname) {

  (`xcopy d:\\loadvast.txt c:\\ /I`);
   
 }

  open TESTF, $syroot;
  
  if ($! eq ) {

  print good;

   if ($nsname eq $ttname) {

close TESTF;

(system 'erase shop1\\c\\loadvast.txt');

  }
  
 } else { 
 
   print bad;

  }




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: still not catching error

2002-02-01 Thread John Edwards

Try

$result = `rsh $plant /u1/bin/forkit '/u1/bin/work.pl'`;

print $result;

You are storing the output of the rsh... command into the variable. You can
now run a regex on that to check for success/failure.

I don't know what the output should be but as an example...

$result = `rsh $plant /u1/bin/forkit '/u1/bin/work.pl'`;

if ($result =~ /worked/i) {
print Yep, that worked\n;
} else {
print Ooops. Something went wrong: $result;
}

HTH

John

-Original Message-
From: Alex Harris [mailto:[EMAIL PROTECTED]]
Sent: 01 February 2002 16:52
To: [EMAIL PROTECTED]
Subject: still not catching error


I took out the exec and placed system.  But even though work.pl doesn't 
exist on the remote system, still getting no error.  Help!

if (system(rsh $plant /u1/bin/forkit '/u1/bin/work.pl')  0)
  {
excep( $!\n);
  }

_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: html entity conversion... one liner?

2002-01-31 Thread John Edwards

$item  =~ s//lt;/g; $item  =~ s//gt;/g;

Well. It is on one line ;)

John

-Original Message-
From: KAVANAGH, Michael [mailto:[EMAIL PROTECTED]]
Sent: 31 January 2002 14:06
To: '[EMAIL PROTECTED]'
Subject: html entity conversion... one liner?


I thought it would be good to be able to do this:

$item = blah;
$item  =~ tr//(lt;)(gt;)/;

to convert those  symbols to their entity references.
however, the tr operator doesn't seem to like using () to group... any
comments on how to make this operation in to a one-liner?

Thanks
Mike



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Modifying/Additng text in a file

2002-01-31 Thread John Edwards

If the file is fixed in this format, then you could do a check for 

   )

and write the line after that is found. Then continue with the file. For
example

open IN, c:/input.txt || die Can't open c:/input.txt: $!;
open OUT, c:/new.txt || die Can't create c:/new.txt: $!;

while (IN) {
if (/\s+)/) { # One or more spaces followed by a right bracket
# The line has been found, so print it out and add the
desired text to the new file
print OUT;
print OUT ABC = 1.1\n;
} else {
print OUT;
}
}

close IN;
close OUT;

You may need to escape the right bracket in the regex. So it looks like
this:

/\s+\)/

I haven't tested it.

HTH

John

-Original Message-
From: pn [mailto:[EMAIL PROTECTED]]
Sent: 31 January 2002 14:05
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Modifying/Additng text in a file


I have a file whose contents are of the form :

NET_A OUTPUT (
   REQUIRED (
  _UP %0.093 BR CLK
  _DN %0.093 BR CLK
   )
)

NET_B OUTPUT (
   REQUIRED (
  _UP %0.093 BR CLK
  _DN %0.093 BR CLK
   )
)


I would like to read in this file in and modify the
contents to be as follows :

NET_A OUTPUT (
   REQUIRED (
  _UP %0.093 BR CLK
  _DN %0.093 BR CLK
   )

ABC = 1.1// Insert this expression
)

NET_B OUTPUT (
   REQUIRED (
  _UP %0.093 BR CLK
  _DN %0.093 BR CLK
   )
ABC = 1.1  //  Insert this expression
)

Any pointer on how to accomplish this would be greatly
appreciated. Could this be accomplished by using a
regexp ?

Thanks

PN



__
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: html entity conversion... one liner?

2002-01-31 Thread John Edwards

Why *must* it be a one liner. I think my suggestion is easier to understand
for someone having to maintain your code. If there is no other reason than
I want a one liner to do this on one line, then why not do it on two??
Just because it is possible in one line, doesn't mean it's the best
approach.

To me this:

$item = blah;

$item  =~ s//lt;/g;
$item  =~ s//gt;/g;

Seems far easier to understand than either this:

$item = blah;

$item =~ s/([])/''. ($1 eq'' ? 'l':'g') . 't;'/eg;

or this:

my %entity = (
'' = 'lt;',
'' = 'gt;',
'' = 'amp;',
);

$item = blah;

$item =~ s/([])/$entity{$1}/ge;

which isn't even a one liner as you have to define a lookup hash to begin
with.

All IMHO ;)

John

-Original Message-
From: Briac Pilpré [mailto:[EMAIL PROTECTED]]
Sent: 31 January 2002 14:35
To: [EMAIL PROTECTED]
Subject: Re: html entity conversion... one liner?


On Thu, 31 Jan 2002 14:06:06 -, Michael Kavanagh
[EMAIL PROTECTED] wrote:
 I thought it would be good to be able to do this:
 
 $item = blah;
 $item  =~ tr//(lt;)(gt;)/;
 
 to convert those  symbols to their entity references. however, the
 tr operator doesn't seem to like using () to group... any comments on
 how to make this operation in to a one-liner?

Here's a possible suboptimal one-liner approach:


#!/usr/bin/perl -w
use strict;

my $item = gahbuh/gah zoh;

$item =~ s/([])/''. ($1 eq'' ? 'l':'g') . 't;'/eg;

print $item;


__END__



-- 
briac
  dynamic .sig on strike, we apologize for the inconvenience 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Writing to a file

2002-01-31 Thread John Edwards



What OS are you running? I've included a script that uses Win32::OLE to
interface with Excel. You'll need to be on a Win32 machine, with Excel
installed.

There is also a module called Spreadsheet::WriteExcel which is platform
independant, but I have not had any experience using this.

HTH

John

-Original Message-
From: Lance Prais [mailto:[EMAIL PROTECTED]]
Sent: 31 January 2002 17:46
To: PERL
Subject: Writing to a file


I have a question regarding writing to a file.

I have written a script and my experiences in perl thus far has been limited
to outputting data to a JSP page but in this case I need to send it to a
excel file.  Does anyone know if there are examples out there that can show
me how to do this?

Thank you in advance

Lance


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.


 eventlog.zip  



eventlog.zip
Description: Binary data

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Debug some simple code

2002-01-31 Thread John Edwards

Change

until ($number=999) {

and 

if ($number=999) {

to == 999. You are assigning the value 999 to the $number var in both cases,
not checking if it is equal to 999.

Simple mistake, we've all made it ;)

HTH

John

P.S Here is how I would code this script.

use strict;
my ($number, $total);

until ($number == 999) {
print Please input your number: ;
chomp($number=STDIN);
$total += $number unless $number == 999;
}

print Your total is: $total\n

-Original Message-
From: Rambog [mailto:[EMAIL PROTECTED]]
Sent: 31 January 2002 16:10
To: [EMAIL PROTECTED]
Subject: Debug some simple code


I am attempting a program that reads a list of numbers from the screen until
the number 999 is read.  It then prints the sum of all numbers read- with
the exception of the 999.

My code looks like:

until ($number=999) {
print Please input your number:\n;
chomp($number=STDIN);
@a=$number;
}
foreach $i (@a) {
$c+=$i;
}
if ($number=999) {
print Your total is: $c\n
}

The program immediately terminates with and the line Your total is: is
output with a  a blank value.  It never even prompts me to input a number.
What am I doing wrong?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: How to prevent redefining a variable with use strict?

2002-01-28 Thread John Edwards

You could use a constant instead.

-- code --

use strict;
use constant INDEX = 5; # I'm assuming $i refers to an index. Use more
descriptive variable names...

print (Value of index . INDEX . \n);

INDEX = 6;

-- end code --

Run that and you will get the following error.

Can't modify constant item in scalar assignment at test.pl line 6, near 6;
Execution of test.pl aborted due to compilation errors.

Remove that line and it will work.

HTH

John

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 28 January 2002 16:03
To: [EMAIL PROTECTED]
Subject: How to prevent redefining a variable with use strict?


Friends,

When we use strict pragma, is there a way to prevent redefining a
variable?


use strict;
my ($i) = 5;# $i defined
print (Val of i = $i);
my ($i) = 6;# $i redefined?Could this be tagged as an
error?
print (Val of i = $i);



Thanks,
Rex


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: simple perl question

2002-01-25 Thread John Edwards

This line

$total += /a([\d.]+)z/;

is adding the number of successful matches (1 for each iteration in this
case) of the regex to $total. There are three lines, three matches.

You need to store the result of the regex as a list value, not scalar.

while (IN) {
($match) = /a([\d.]+)z/;
$total += $match;
}

HTH

John   

-Original Message-
From: Stuart Clark [mailto:[EMAIL PROTECTED]]
Sent: 25 January 2002 02:58
To: Perl List
Subject: simple perl question


Hi
Please help if you can.
Thanks again
Stuart Clark


How do I add all the number between the a and the z
My output file only gives me the instances of the matching pattern and
not the total

# start of file test
3034364717283459322a15.32zM042001H
3045434551648534245a243.56zM040532H
3053232540927543293a2.45zM040332H
# end of file test

open (IN,test)  ||  die Could not open the test file\n;
open (OUT,total)  || die Error could not create the output
file\n;

while (IN) {
   
$total += /a([\d.]+)z/;
}

print OUT $total;

close(IN)   || die Error cannot close test file\n;
close(OUT)|| die Error cannot close output file\n;

# output file must look like this
261.33

# At the moment it gives me this
3


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: simple perl question

2002-01-25 Thread John Edwards

Oh. One more thing.

Your regex should have the . escaped. Currently it is matching on either a
number or *any character* between the a and z. Although this works, it may
bite you if you have a line like this...

3034364717283459322a15f32zM042001H

which you don't want to include in the results.

Here is how it should look

/a([\d\.]+)z/

John

-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]]
Sent: 25 January 2002 09:16
To: 'Stuart Clark'; Perl List
Subject: RE: simple perl question


This line

$total += /a([\d.]+)z/;

is adding the number of successful matches (1 for each iteration in this
case) of the regex to $total. There are three lines, three matches.

You need to store the result of the regex as a list value, not scalar.

while (IN) {
($match) = /a([\d.]+)z/;
$total += $match;
}

HTH

John   

-Original Message-
From: Stuart Clark [mailto:[EMAIL PROTECTED]]
Sent: 25 January 2002 02:58
To: Perl List
Subject: simple perl question


Hi
Please help if you can.
Thanks again
Stuart Clark


How do I add all the number between the a and the z
My output file only gives me the instances of the matching pattern and
not the total

# start of file test
3034364717283459322a15.32zM042001H
3045434551648534245a243.56zM040532H
3053232540927543293a2.45zM040332H
# end of file test

open (IN,test)  ||  die Could not open the test file\n;
open (OUT,total)  || die Error could not create the output
file\n;

while (IN) {
   
$total += /a([\d.]+)z/;
}

print OUT $total;

close(IN)   || die Error cannot close test file\n;
close(OUT)|| die Error cannot close output file\n;

# output file must look like this
261.33

# At the moment it gives me this
3


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: please Help ! Database connection

2002-01-25 Thread John Edwards

This looks like your script isn't returning the correct HTML headers. It's
not a database connection fault. I would strongly suggest using the CGI.pm
module. This provides an easy interface to all things CGI.

All this to the top of your script.

use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);

then when you start displaying output add this

print header;
print start_html;

Go here for a full description of the CGI.pm methods.

http://stein.cshl.org/WWW/software/CGI/

HTH

John

-Original Message-
From: mb [mailto:[EMAIL PROTECTED]]
Sent: 25 January 2002 14:34
To: [EMAIL PROTECTED]
Subject: please Help ! Database connection


Hi,
I just need when does this kind of error is raised : 
[Fri Jan 25 15:16:29 2002] [error] [client 127.0.0.1] malformed header from
script. Bad header=Error connecting to gestion100:
c:/phpweb/cgi-bin/majbd.cgi

Kind Regards, asma



--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: please Help ! Database connection

2002-01-25 Thread John Edwards

Yes, but use CGI::Carp qw(fatalsToBrowser); will print most perl error
messages to the html output.

This is very useful if you are trying to develop a CGI script remotely. Once
you start using the other features of the module, it makes CGI development
fly along.

Even though there is overhead in using the module, I never bother with print
Content-type: text/html\n\n; as it won't display errors.

Just my 0.02c

John

-Original Message-
From: Jon Molin [mailto:[EMAIL PROTECTED]]
Sent: 25 January 2002 14:48
To: John Edwards
Cc: 'mb'; [EMAIL PROTECTED]
Subject: Re: please Help ! Database connection


or do:
print Content-type: text/html\n\n;

/Jon

John Edwards wrote:

 This looks like your script isn't returning the correct HTML headers. It's
 not a database connection fault. I would strongly suggest using the CGI.pm
 module. This provides an easy interface to all things CGI.

 All this to the top of your script.

 use CGI qw(:standard);
 use CGI::Carp qw(fatalsToBrowser);

 then when you start displaying output add this

 print header;
 print start_html;

 Go here for a full description of the CGI.pm methods.

 http://stein.cshl.org/WWW/software/CGI/

 HTH

 John

 -Original Message-
 From: mb [mailto:[EMAIL PROTECTED]]
 Sent: 25 January 2002 14:34
 To: [EMAIL PROTECTED]
 Subject: please Help ! Database connection

 Hi,
 I just need when does this kind of error is raised :
 [Fri Jan 25 15:16:29 2002] [error] [client 127.0.0.1] malformed header
from
 script. Bad header=Error connecting to gestion100:
 c:/phpweb/cgi-bin/majbd.cgi

 Kind Regards, asma

 --Confidentiality--.
 This E-mail is confidential.  It should not be read, copied, disclosed or
 used by any person other than the intended recipient.  Unauthorised use,
 disclosure or copying by whatever medium is strictly prohibited and may be
 unlawful.  If you have received this E-mail in error please contact the
 sender immediately and delete the E-mail from your system.

 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: %

2002-01-24 Thread John Edwards

It's a hash.

You can use it in the following way.


-- code --
%daysPerMonth = ('Jan' = 31, 'Feb' = 28, 'Mar' = 31);

print March has $daysPerMonth{'Mar'} days in it\n;

-- end code --

It allows you to look up a value using a key. In this instance, the value is
31, and the key is Mar.

Take a look at this URL for some more details.

http://www.netcat.co.uk/rob/perl/win32perltut.html#124-AssociativeArrays

HTH

John

-Original Message-
From: Naveen Parmar [mailto:[EMAIL PROTECTED]]
Sent: 24 January 2002 16:47
To: [EMAIL PROTECTED]
Subject: %


Hello,

What does % represent in the following statement?
%daysPerMonth = ('Jan' = 31, 'Feb' = 28, 'Mar' = 31);

Is %daysPerMonth an array? Do we really need an array for this?

TIA,
- NP

_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Press any key to continue...

2002-01-24 Thread John Edwards

Is this on windows??

If so:

system(pause);

HTH

John

-Original Message-
From: Dmitri Zakharov [mailto:[EMAIL PROTECTED]]
Sent: 23 January 2002 19:47
To: [EMAIL PROTECTED]
Subject: Press any key to continue...


Hi everybody;

Here's a perl newbie problem:
I'm wondering how could I suspend the execution of 
the perl script untill the user hits any key ( not only Enter )

Any help is appreciated.

dmitri--; :o(

-- 
Dmitri Zakharov
email: [EMAIL PROTECTED]
phone: (514)938-7389

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: file handle not working in NT

2002-01-24 Thread John Edwards

Have you tried

if( $^O eq MSWin32){
open(INPUT, ../SampleConfig.xml) or die Can't open
.../SampleConfig.xml: $!;
} else {
open(INPUT, SampleConfig.xml) or die Can't open SampleConfig.xml:
$!;
}

Note forward slash...

John

-Original Message-
From: K.Srinivas [mailto:[EMAIL PROTECTED]]
Sent: 24 January 2002 08:11
To: [EMAIL PROTECTED]
Subject: file handle not working in NT


Hi,

I have a piece of code in which I have to use some filehandles:

if( $^O eq MSWin32){
open(INPUT, ..\SampleConfig.xml);
}
else {
open(INPUT, SampleConfig.xml);
}

open(OUTPUT, LoaderConfig.xml);

while(INPUT)
{print Hi hello\n;
if ($_ =~ /UserName/){print OUTPUT   UserName$db_user/UserName\n;
}

The problem I am facing in Nt machine with the script is that it does not
take relative paths in the input file handle. ANy suggestions as to why this
is so whereare in UNIX relative apths are getting accepted.
K.Srinivas


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: regular expression help

2002-01-22 Thread John Edwards

Escape the brackets like so.

s/\(locked\)//;

John

-Original Message-
From: David Samuelsson (PAC) [mailto:[EMAIL PROTECTED]]
Sent: 22 January 2002 09:37
To: '[EMAIL PROTECTED]'
Subject: regular expression help


Hello!

if i have this line ROXETTE_PC_SW_R1D08 (locked)

and just want to remove the (locked) part from it with an regexp how would
that look?

i can do: s/(locked)// that leaves the  pesky () how can i get rid off
those?

//Dave




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: What is wrong with this?

2002-01-22 Thread John Edwards

errors out via the web What error message do you get? Is there anything in
the Apache error logs that's relevant?

Does the web server account have write access to the ipaccess.log file?

John

-Original Message-
From: Michael Pratt [mailto:[EMAIL PROTECTED]]
Sent: 22 January 2002 11:44
To: [EMAIL PROTECTED]
Subject: What is wrong with this?


I am trying to log the users IP via the web and nothing happens the date
nore the ip get there. Also if I put the append to the open statement I get
an error via the web also.  This is the code. I got it to show up via the
web but it never gets to the file.  Is there something I am missing?

#!/usr/bin/perl

$logfile = '/usr/local/apache/logs/ipaccess.log';
$date = scalar localtime;

open(IPLOG, $logfile) || die Cannot open $logfile;
$ip = $ENV{'REMOTE_ADDR'};
print IPLOG $date;
print IPLOG $ip;
close IPLOG;


If I do it this way it errors out via the web:

#!/usr/bin/perl

$logfile = '/usr/local/apache/logs/ipaccess.log';
$date = scalar localtime;

open(IPLOG, $logfile) || die Cannot open $logfile;
$ip = $ENV{'REMOTE_ADDR'};
print IPLOG $date;
print IPLOG $ip;
close IPLOG;


Mike




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: to die, croak, or confess

2002-01-21 Thread John Edwards

You can do this

die \n;

The newline means die will not print anything out to STDOUT. (other than a
new line...)

HTH

John

-Original Message-
From: Alex Harris [mailto:[EMAIL PROTECTED]]
Sent: 21 January 2002 14:22
To: [EMAIL PROTECTED]
Subject: to die, croak, or confess


I need to place code that leaves my program entirely if certain errors occur

(mostly on opening a file).  However I don't want ANY messages going 
anywhere except my $errlog.  (I noticed die, seem to always show a message 
at the command line).  What's the best way to handle say the following then 
if an error occurs?

open(MFILE, $file)



_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Exchange mailbox size

2002-01-21 Thread John Edwards

If you set the logging options of Exchange to the correct level, whenever a
user is sent a storage limit warning it will be recorded in the eventlog of
the mail server. This can then be extracted using Perl if you wish.

John

-Original Message-
From: Simon Rowan [mailto:[EMAIL PROTECTED]]
Sent: 21 January 2002 15:10
To: 'PERL beginners'
Subject: RE: Exchange mailbox size


Ideally, I would like to log these to a file for reporting, so thought PERL
would be the best way of doing this.

THanks

Simon

-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]]
Sent: 21 January 2002 13:07
To: 'Simon Rowan'; 'PERL beginners'
Subject: RE: Exchange mailbox size


Ummm. Exchange can do this for you. Just set the size limit of the warn user
section and exchange will fire off mails to them when the limit is passed.

HTH

John

-Original Message-
From: Simon Rowan [mailto:[EMAIL PROTECTED]]
Sent: 21 January 2002 13:09
To: 'PERL beginners'
Subject: Exchange mailbox size


Does anybody know of a module that will return the total size of a users
Exchange 5.5 mailbox. I want to be able to give users who have large
mailboxes loads of automated grief !!

Cheers


___
Evolution is the investment banking and venture capital industry's 
first choice for practical advice on strategy, business process and
the application of advanced technology. 


Simon Rowan Tel:  +44 (0) 20 7664 6640
Evolution   Fax: +44 (0) 20 7664 6641
Peninsular House
30-36 Monument Street   Email:  [EMAIL PROTECTED]
London EC3R 8LJ URL:http://www.evolution.net
United Kingdom
___
 
The information in this Internet e-mail is confidential and is 
intended solely for the addressee.  Access, copying or re-use 
of information in it by anyone else is unauthorised.  Any views
or opinions presented are solely those of the author and do
not necessarily represent those of Evolution or any of its
affiliates.  If you are not the intended recipient please contact 
Evolution, London, +44 (0) 20 7664 6640
___




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Regex Assistance

2002-01-18 Thread John Edwards

Thanks. That did the trick. Much appreciated.

John

-Original Message-
From: Joshua Colson [mailto:[EMAIL PROTECTED]]
Sent: 17 January 2002 17:58
To: '[EMAIL PROTECTED]'
Subject: RE: Regex Assistance


I've commented out two lines in your code and replaced them with mine.

I think it should work, but let us know if it doesn't.

Good Luck!

Joshua Colson
Systems Administrator
Giant Industries, Inc.
(480) 585-8714
[EMAIL PROTECTED]


-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 17, 2002 10:43 AM
To: Perl Beginners (E-mail)
Subject: Regex Assistance


Hi group. 

I have the following snippet of code. It's not working and I've been going
round in circles trying to figure out why.

I need a routine that will look at the filename, if that filename already
exists, then add a (1) to the end. I've got the checking for existance
sorted, it's the generation of the new file name that is the issue.

E.g. test.txt exists so create test(1).txt

If test(1).txt exists then create test(2).txt and so on

Here is the problematic code I have so far

-- code --
my ($name, $ext) = split(/\./,$fileoutname);

#if ($name =~ /\((\d{1,1})\)$/) { # Looks for (1) on the end for example
if ($name =~ /\((\d)\)$/) { # the \d assumes one character. {1,1} is
just to specify range.
my $number = $1;
$number++;
# $name =~ tr/\(\d\)/\($number\)/;
$name =~ s/\(\d\)$/\($number\)/;# this line should do the
trick.
} else {
$name .= (1);
}

$fileoutname = $name\.$ext;

-- end code --

There's probally some really basic errors in there, and maybe a much better
way of doing it...

TIA

John




--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Regex Assistance

2002-01-17 Thread John Edwards

Hi group. 

I have the following snippet of code. It's not working and I've been going
round in circles trying to figure out why.

I need a routine that will look at the filename, if that filename already
exists, then add a (1) to the end. I've got the checking for existance
sorted, it's the generation of the new file name that is the issue.

E.g. test.txt exists so create test(1).txt

If test(1).txt exists then create test(2).txt and so on

Here is the problematic code I have so far

-- code --
my ($name, $ext) = split(/\./,$fileoutname);

if ($name =~ /\((\d{1,1})\)$/) { # Looks for (1) on the end for example
my $number = $1;
$number++;
$name =~ tr/\(\d\)/\($number\)/;
} else {
$name .= (1);
}

$fileoutname = $name\.$ext;

-- end code --

There's probally some really basic errors in there, and maybe a much better
way of doing it...

TIA

John


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Thumbnail images on-the-fly

2002-01-16 Thread John Edwards

I think you'll need to look at the image magik module for creating the
thumbnails. I've looked at this in the past, and come away with headaches,
but I believe it's the right tool for the job. Good luck

John

-Original Message-
From: Scott R. Godin [mailto:[EMAIL PROTECTED]]
Sent: 16 January 2002 10:24
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Thumbnail images on-the-fly


I've got an idea kicking around in my head .. 

having a web-directory that can have image files added to it, taken 
away, or prefaced with . to have them be ignored temporarily without 
removing them.

initial run of the .cgi indexes the directory into a local database 
file, and creates thumbnails of each image in the directory (havn't 
decided whether they should be variable size yet, as I'm not certain 
about the tool I'd need to use for this)

future runs of the .cgi double check the directory, match it against the 
database and create further thumbnails if necessary, or update the db to 
reflect images no longer listed, or marked with . as in do not display

upon updating, it then provides an html-page with the thumbnails laid 
out in a table for easy clicking by the user. 

This is pretty straightforward, and I'm sure it's been done in the past. 

What I'm looking for is a bit of a shove in the right direction from 
those of you who have walked this path before.. I've never worked with 
the graphical Perl modules yet, and am really unfamiliar with which 
tools (i.e. modules) would be the most elegant and efficient for a job 
like this. 

any pointers? I'm happy to toddle off and download and read my face off 
-- that's not a problem.. I'd just like to have some indication on which 
direction to start walking. :-)

print pack H*,
4a75737420416e6f74686572204d61635065726c204861636b65722c0d;
-- 
Scott R. Godin| e-mail : [EMAIL PROTECTED]
Laughing Dragon Services  |web : http://www.webdragon.net/
It is not necessary to cc: me via e-mail unless you mean to speak off-group.
I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox.
:-)

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Thumbnail images on-the-fly

2002-01-16 Thread John Edwards

I think you'll need to look at the image magik module for creating the
thumbnails. I've looked at this in the past, and come away with headaches,
but I believe it's the right tool for the job. Good luck

John

-Original Message-
From: Scott R. Godin [mailto:[EMAIL PROTECTED]]
Sent: 16 January 2002 10:24
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Thumbnail images on-the-fly


I've got an idea kicking around in my head .. 

having a web-directory that can have image files added to it, taken 
away, or prefaced with . to have them be ignored temporarily without 
removing them.

initial run of the .cgi indexes the directory into a local database 
file, and creates thumbnails of each image in the directory (havn't 
decided whether they should be variable size yet, as I'm not certain 
about the tool I'd need to use for this)

future runs of the .cgi double check the directory, match it against the 
database and create further thumbnails if necessary, or update the db to 
reflect images no longer listed, or marked with . as in do not display

upon updating, it then provides an html-page with the thumbnails laid 
out in a table for easy clicking by the user. 

This is pretty straightforward, and I'm sure it's been done in the past. 

What I'm looking for is a bit of a shove in the right direction from 
those of you who have walked this path before.. I've never worked with 
the graphical Perl modules yet, and am really unfamiliar with which 
tools (i.e. modules) would be the most elegant and efficient for a job 
like this. 

any pointers? I'm happy to toddle off and download and read my face off 
-- that's not a problem.. I'd just like to have some indication on which 
direction to start walking. :-)

print pack H*,
4a75737420416e6f74686572204d61635065726c204861636b65722c0d;
-- 
Scott R. Godin| e-mail : [EMAIL PROTECTED]
Laughing Dragon Services  |web : http://www.webdragon.net/
It is not necessary to cc: me via e-mail unless you mean to speak off-group.
I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox.
:-)

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: vCal (try2)

2002-01-14 Thread John Edwards

Maybe these will help...

http://www.imc.org/pdi/pdiprodslist.html

http://www.w3.org/People/Bos/Plan2vcs/plan2vcs

John

-Original Message-
From: Booher Timothy B 1stLt AFRL/MNAC
[mailto:[EMAIL PROTECTED]]
Sent: 14 January 2002 14:58
To: '[EMAIL PROTECTED]'
Subject: vCal (try2)



I sent this out last tuesday and no responses so far, just about 5 people
emailing me to ask if I had gotten any answers which tells me there is a lot
of interest in this question. If anyone has any knowledge in this subject
matter, please do tell the rest of us as we are eager for an answer . . .

thanks,

tim

p.s. several people asked about the vCal standard -- it can be found here:
http://www.imc.org/pdi/


---

Sent: Tuesday, January 08, 2002 5:30 PM
To: [EMAIL PROTECTED]
Subject: Import Appointments into Outlook using Perl and vCalendar


Hello all,

At our lab we constantly have emails sent out in the form:

7-15 JanTesting of Product X (POC:  Joe Smith)  Room 265
2 Jan   Leaders Meeting  (POC: John Doe)Room 121
8 Jan   Review   (POC: Tom) Room 30

I am trying to take these word documents and create some time of vCalendar
file so I can automatically import all of these dates into a personal
information manager (such as Outlook or Palm). As it is everyone is
laboriously adding these things to their respective calendars or manually
inputting this information into Outlook.

Does anyone know of a module that takes inputs and generates vCalendar
files. Is there a better way to do this?

Any thoughts?

tim


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: excluding comments in a line

2002-01-14 Thread John Edwards

How about splitting the line.

@lines = (foo=bar # stuff, bar=foo # more stuff);

foreach (@lines) {
my ($line) = split(/\s*#/);
print $line\n;
}

John

-Original Message-
From: Yacketta, Ronald [mailto:[EMAIL PROTECTED]]
Sent: 14 January 2002 17:45
To: Beginners (E-mail)
Subject: excluding comments in a line


Folks,

I am reading in a .cfg file and exclude comments (#) and spaces at the
beginning of the line
how would I lop off any comments in a line?

IE:

Key value # comment here


Regards,
Ron

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Using SMPT on Windows NT

2002-01-11 Thread John Edwards

I regularly use a nice script, available here
http://www.liquidsilver.com/scripts, called Form2Mail. It's intended to
provide a generic interface to mail data from a web form.

It had a nice example of using sockets to send mail. This should be portable
between OSs as all mail code is done via a socket connection to an SMTP
server on port 25.

HTH

John

-Original Message-
From: Rohesia Hamilton Metcalfe [mailto:[EMAIL PROTECTED]]
Sent: 10 January 2002 19:08
To: [EMAIL PROTECTED]
Subject: Using SMPT on Windows NT


Hello,

Thanks to Eric and Christopher, who pointed out the bit of my
form-processing script that doesn't
carry over to Windows NT (from UNIX, where it is working fine) -- following
my post yesterday. 

And apologies to all for what I realize was a too-long post.

However, I am still in the dark as to HOW much needs changing.

The reference, which I know is wrong for the NT server the script will be
moving to, is to a
sendmail program, like so:

$emailProgram   = | /usr/sbin/sendmail -oi -t;

I tried changing this to:

$emailProgram   = | /usr/sbin/SMPT -oi -t;

.just in case this would do it (as I was told I'd have to genericize
the script to use SMPT),
but it didn't. Christopher tells me NT probably doesn't understand the / /
way of describing
directory structures either.

Is there somewhere I can go to find out how different a script needs to be
for Windows NT than for
a UNIX server? Or how to write to use SMPT instead of sendmail? (I don't
know anything about
different mail systems). I'm hoping it's no more difficult than finding the
right path to SMPT
(and then everything will work?) but perhaps genericize means much more
than that?

Many many thanks if anyone can point me in a bit more of the right
direction,

Rohesia



=
Rohesia Hamilton Metcalfe

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Help with File::Find

2002-01-11 Thread John Edwards

Something I just found via a google search...

foreach (@_) {
$min = $_ if $min  $_;
}

$min now holds the smallest value of the array.

BTW, shouldn't line 21 be write $fileref STDOUT? I've not gone over the
code, but if you are looking for the smallest array value, then only writing
out once that's been found I'd guess you were trying to write out that
value.

John

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 11 January 2002 16:58
To: [EMAIL PROTECTED]
Subject: Help with File::Find


Hi Everyone!

I'm fairly new to Perl, and completely new to submitting to the list, so
please be easy on me.  :-)

The purpose of the code I wrote (listed below) is to go through the current
directory and all of its subdirectories and report the filename, size and
age of the x largest files, where x depends on the argument supplied on the
command line and the number of files in the directory.  I'm sure there's an
easier way to do this with a UNIX utility (or with Perl), but this program
has been a good learning experience for me.

The code below runs without any syntax errors, but File::Find (which I love
and use frequently) or the -e file test doesn't give the results I expect.
Specifically, my (explicit) checks show that the test in line 11 does not
always evaluate to TRUE for values of $_ corresponding to legitimate (i.e.,
existing and size  0) files, which means I'm missing files that should be
in my final output.  If I change line 11for debugging purposes to simply

if ($_){

all files (including the previously missed ones) are printed out (also
along with the directories now) as expected, but for the files that would
not have passed the (-e $_) test, the values assigned for filesize and age
in line 12 are (tested to be) undefined.  If this is any help, the files
that don't pass the (-e $_) of test of line 11 are (perhaps coincidentally)
the biggest files (~55 GB)  in the directory.

I've researched the File::Find documentation and checked the FAQ's with no
luck, so I'm hoping someone out there can help me.

Also, is there a function that returns a minimum value in an array?  It's
not my biggest concern right now, but it would make line 20 simpler.

 1: #!/usr/local/bin/perl -w
 2:
 3: use Cwd;
 4: use File::Find;
 5: use FileHandle;
 6:
 7: ($filecount = shift) || ($filecount = 20);
 8:
 9: sub wanted{
10:  my $flag = 0;
11:  if (-e $_){
12:   push(@filelist, [$File::Find::name, -s $_, -M $_]);
13:}
14:  }
15:
16: $dir = cwd();
17:
18: find(\wanted,$dir);
19:
20: foreach $fileref ((sort {$b-[1] = $a-[1]} @filelist)[0..(sort( {$a
=$b} $filecount,scalar(@filelist)-1))[0]]){
21:  write STDOUT;
22:  }
23:
24: STDOUT - format_name(STDOUT_BOT);
25: write STDOUT;
26:
27: format STDOUT_TOP=
28: FILENAME
FILE SIZE (BYTES)  AGE (DAYS)
29:

--
30: .
31: format STDOUT=
32:
@
 

@
33: $fileref-[0], $fileref-[1], sprintf(%4.0f, ($fileref-[2]))
34: .
35: format STDOUT_BOT=
36:

-
37: .
...


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Data manipulation problem

2002-01-11 Thread John Edwards

Try changing to this.

printf emaildata is $emaildata[0];

$emaildata[0] is using the element in a scalar format
@emaildata[0] is using the element in an array format, which is converted to
scalar by perl when printing out in this case. The array only has the one
element [0]. When you take an array in scalar context you get the number of
elements in the array, hence it prints 1.

HTH

John

-Original Message-
From: Conor Lillis [mailto:[EMAIL PROTECTED]]
Sent: 11 January 2002 13:08
To: PERL Beginners (E-mail); Perl-Win32-Users (E-mail)
Subject: Data manipulation problem


Hi all,
hopefully someone can help me with this, I will describe my problem as best
as I can. I am opening 2 files, one has a list of NT account names, The 2nd
has a list of NT account names  e-mail addresses. I am trying to match an
NT account name from the first list to an e-mail address in the second file
by NT account name. 
My comments are to explain what my bumbling logic is, can someone tell me
how I might try and pull the e-mail address from the @emaildata ?

--script starts
-
open (LIST1, input.txt);
open (MAILLIST, nt-smtp.txt);
@maillist=MAILLIST;
while(LIST1) 

{
# Split the name from the .txt extension eg. conorl
@data = split(/\./, $_);

# read the name
$Name=$data[0]; 

# print the name so we know what is happening
printf $Name\n;   

# Grep the name from the second file, outputting result to @data1
@data1=grep /$Name/i, @maillist;

# print the @data1 so we know wheat is happening again
printf DATA1 @data1;  

# split @data1, to isolate the e-mail address from the name eg.
[EMAIL PROTECTED]
@emaildata = split(/,/, @data1);

# print the e-mail address, NOT. This prints an integer, I am not
sure why. HELP this where it goes pear-shaped.
printf emaildata is @emaildata[0];
}
--script
ends
sample input.txt data
conorl.txt

sample nt-smtp.txt data
conorl,[EMAIL PROTECTED]




The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised.if you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it is prohibited and may be unlawful. Please note that any
views, opinions or advice contained in this email are those of the sending
individual and not necessarily those of the firm. It is possible for data
transmitted by e-mail to be deliberately or accidentally corrupted or
intercepted. For this reason, where the communication is by e-mail, JE Davy
does not accept any responsibility for any breach of confidence which may
arise from the use of this medium. If you have received this e-mail in error
please notify us immediately at mailto:[EMAIL PROTECTED] and delete this
e-mail from your system.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Data manipulation problem

2002-01-11 Thread John Edwards

OK. I've been over all your code. Here is the way I would do this. N.B I've
not checked for errors or typos. It's commented to explain the changes.

Basically instead of having to grep the second file for every iteration of
the foreach loop, you initialize a hash with the data from the second file.
This is in the format name=email. This allows you to do a fast lookup for
the users email address when you are processing the input.txt file.

HTH

John

-- Code follows --
open (LIST1, input.txt) or die Can't open input.txt: $!; # Always check
for errors when opening a filehandle
open (MAILLIST, nt-smtp.txt) or die Can't open nt-smtp.txt: $!;
my %mail_lookup;

# Loop over each line in the MAILLIST file. This doesn't require having to
slurp the file into memory.
foreach (MAILLIST) {
# Split the element into name and mail parts
my ($name, $mail) = split(/,/);

# Store the data in the mail_lookup hash. Use the name as the key
and the mail address as the data
$mail_lookup{$name} = $mail;
}

close MAILLIST; # Close the MAILLIST filehandle. It's contents have been
dealt with

while(LIST1) {
# Split the name from the .txt extension eg. conorl
my ($Name) = split(/\./, $_); # Use () around variable being
assigned. This turns the returned array from split and stores the first
element as the $Name scalar

# read the name
# $Name=$data[0]; This line is not needed, all done in one step
above

# print the name so we know what is happening
print $Name\n; # You don't need to use printf unless you are
formatting the output. It just adds overhead in this instance.

# The below three steps aren't needed, they were perfomred in the
foreach loop above

# Grep the name from the second file, outputting result to @data1
# @data1=grep /$Name/i, @maillist;  

# print the @data1 so we know wheat is happening again
# printf DATA1 @data1;

# split @data1, to isolate the e-mail address from the name eg.
[EMAIL PROTECTED]
# @emaildata = split(/,/, @data1);

# print the e-mail address, NOT. This prints an integer, I am not
sure why. HELP this where it goes pear-shaped.
print emaildata is $mail_lookup{$Name};   # Lookup the mail
address from the hash with the keyname $Name.
}
-- Code Ends --


-Original Message-
From: Conor Lillis [mailto:[EMAIL PROTECTED]]
Sent: 11 January 2002 13:08
To: PERL Beginners (E-mail); Perl-Win32-Users (E-mail)
Subject: Data manipulation problem


Hi all,
hopefully someone can help me with this, I will describe my problem as best
as I can. I am opening 2 files, one has a list of NT account names, The 2nd
has a list of NT account names  e-mail addresses. I am trying to match an
NT account name from the first list to an e-mail address in the second file
by NT account name. 
My comments are to explain what my bumbling logic is, can someone tell me
how I might try and pull the e-mail address from the @emaildata ?

--script starts
-
open (LIST1, input.txt);
open (MAILLIST, nt-smtp.txt);
@maillist=MAILLIST;
while(LIST1) 

{
# Split the name from the .txt extension eg. conorl
@data = split(/\./, $_);

# read the name
$Name=$data[0]; 

# print the name so we know what is happening
printf $Name\n;   

# Grep the name from the second file, outputting result to @data1
@data1=grep /$Name/i, @maillist;

# print the @data1 so we know wheat is happening again
printf DATA1 @data1;  

# split @data1, to isolate the e-mail address from the name eg.
[EMAIL PROTECTED]
@emaildata = split(/,/, @data1);

# print the e-mail address, NOT. This prints an integer, I am not
sure why. HELP this where it goes pear-shaped.
printf emaildata is @emaildata[0];
}
--script
ends
sample input.txt data
conorl.txt

sample nt-smtp.txt data
conorl,[EMAIL PROTECTED]




The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised.if you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it is prohibited and may be unlawful. Please note that any
views, opinions or advice contained in this email are those of the sending
individual and not necessarily those of the firm. It is possible for data
transmitted by e-mail to be deliberately or accidentally corrupted or
intercepted. For this reason, where the communication is by e-mail, JE Davy
does not accept any responsibility for any breach of confidence which may
arise from the use of this medium. If you have received this e-mail 

RE: perl sandbox creation

2002-01-10 Thread John Edwards

So you've not tried to solve this on your own yet? Have you got any sample
code?

I'd suggest taking the first few lines from your file and playing with that
as the data file until you get a working script. Then you only have to
process a few lines to see if your code is working or not. It also makes
reverting the system to it's clean state quicker and easier.

You'll need to look into opening files. The foreach method of looping over
them, the split function, the mkdir function, the -e file test operator.

HTH

John

-Original Message-
From: garrett esperum [mailto:[EMAIL PROTECTED]]
Sent: 10 January 2002 06:53
To: [EMAIL PROTECTED]
Subject: perl sandbox creation


Hello all,

Here is my environment:
solaris 2.6
perl 5.6.1

Here are descriptions of the files I am working with:
1) a meta-data text file
2) a creation.pl file
3) a CVS repository

The meta-data file contains information about multiple CVS repository files.

There are hundreds of rows with six columns each in the meta-data file. Each

file in the repository basically has it's own row of information. The rows 
columns are as follows:
Column 1 = file name
Column 2 = file type
Column 3 = file location
Column 4 = file owner
Column 5 = file permissions
Column 6 = currently unused optional column
These columns are seperated by a single tab.

Example row:
foo.html html /one/two/three/four haxor 0755

I want to execute the creation.pl file to read the meta-data file and create

a sandbox from the meta-data information. I need help with the following 
tasks:

1) How do I process each column of every row? How do I grab one row, split 
it up at every tab, and copy the correct file into it's correct directory 
with its correct permissions?

2) How do I create variables for each piece of the split row? Like how do I 
create a variable for the directory path column and then go and create that 
directory path from that variable if it doesn't already exist?

3)How do I grab the files out of CVS and write them to a temp directory?

4)How do I do all of this in a loop for every row of the meta-data file?

I am very appreciative for your help! Thank You!!

-garrett

_
Join the world's largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Manageable code

2002-01-10 Thread John Edwards

I prefer to lay out code like this myself.

if ($foo) {
$foo--;
stuff;
}

if ($bar) {
$baz += $foo
} else {
$baz = $foo  9 
? 3 
: 1;
}

There is less vertical whitespace (by putting the opening brace on the same
lines as the if/else statements. It is also clearer to see which 'if' the
'else' is refering to by placing it on the same line as the closing brace.
Just my opinion, no doubt there are hundreds more. I agree with the rest of
your mail though. Whitespace in code can greatly improve readability if used
correctly, and consistently throughout your programs. Once you find a
readable coding style, it's good practice to stick to it as it will make
reading and debugging your own code much easier.

http://www.perlmonks.org/index.pl?node=perlman%3Aperlstylelastnode_id=148

John

-Original Message-
From: Curtis Poe [mailto:[EMAIL PROTECTED]]
Sent: 10 January 2002 16:45
To: Scott; [EMAIL PROTECTED]
Subject: Re: Manageable code


--- Scott [EMAIL PROTECTED] wrote:
 I admit I am a newbie and making this harder than it really is :)  But, I 
 have a program that is growing by the minute and I want to split it apart 
 into chunks or sub routines.
 
 Here is an example:
 
 sub init_type_99{
 print NEWQUOTES 99; #RecordType
 printf NEWQUOTES (%08d, 1);   #FileBatchTotal
 printf NEWQUOTES (%08d, $count-1);  #TotalRecords
 printf NEWQUOTES (%-237s);  #RecordFiller
 print NEWQUOTES \n;
 }
 
 Yet when I call the sub doing this:
 
 init_type_99();
 I do not get the results I was looking for.  Is it a bad idea to do a sub 
 like this and reserve it to only return a value?

Scott,

A subroutine doesn't necessarily need to return a value, but there are a
couple of things you
could do, in my opinion, to improve it.

1.  Fix the indentation.

Good indentation does not mean good code, but bad indentation is usually
indicative of bad code
and it's harder to read.  Consider the difference between these:

if ($foo){$foo--;stuff;};if($bar){$baz += $foo}
else {$baz = $foo  9 ? 3 : 1;};

Ugh.  That's pretty confusing.  What is the 'else' associated with?  It's
easy to get this wrong. 
Consider an alternative:

if ($foo)
{
$foo--;
stuff;
}
if ($bar)
{
$baz += $foo
}
else
{
$baz = $foo  9 
? 3 
: 1;
}

You might object to all of the whitespace in this version, but it's much
easier to read and to
determine the scope of everything.

2.  Subs should usually be black boxes.  Stuff goes in and stuff goes out.
You should be able to
cut and paste a subroutine directly into another piece of code without any
problems.  This means
that a subroutine should be dependant on its arguments and nothing else.

sub foo
{
my $bar = shift;
if ( $bar  $baz )
{
return;
}
return ++$bar;
}

The above snippet is problematic because it depends upon $baz being declared
outside of itself. 
Two immediate problems crop up.  The first is that changing the name $baz
means you need to track
it down in the subs that use it and change it there, too (part of the goal
of programming should
be to minimize bugs stemming from excessive maintenance).  The other problem
is that this sub is
not general purpose.  What if you want a different test?  You can't.  Here's
a better way:

sub foo
{
my ( $bar, $baz ) = @_;
if ( $bar  $baz )
{
return;
}
return ++$bar;
}

You can now change the variable names to your heart's content and you have a
more general
subroutine!  Good stuff.  Let's apply these thoughts to your code:

   sub init_type_99
   {
   my ( $fh, $count ) = @_;

   my $record = 990001;  # recordtype and
filebatchtotal
   $record   .= sprintf(%08d, $count-1); # total records
   $record   .= ' ' x 237, \n;   # filler

   print $fh $record;
   }

Now, you might not like exactly how I applied everything above (I'd probably
build the record
differently), but I think it gives you a better idea of what I am referring
to.  Since this looks
like a routine to print the header of a report, I might generalize it more.
Maybe passing in the
record type, file batch total and filler length, for example, to make this
applicable to different
record types.

Incidentally, to pass a filehandle in a variable (as I did in the example),
check out the
FileHandle module or IO::File.

Cheers,
Curtis Ovid Poe

=
Ovid on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

-- 
To 

RE: pull line #1 from a file

2002-01-08 Thread John Edwards

That should work. The big problem with it is you are creating an array which
contains the contents of the whole file. Then using only the first element
of that array and ignoring the rest. Depending on the size of your file you
could be wasting huge chunks of memory.

-Original Message-
From: Yacketta, Ronald [mailto:[EMAIL PROTECTED]]
Sent: 08 January 2002 16:06
To: [EMAIL PROTECTED]; Yacketta, Ronald
Cc: Beginners (E-mail)
Subject: RE: pull line #1 from a file


so so close...
I had this


OPEN(FILE,  $g_all_sleepy);
@lines = FILE;
CLOSE(FILE);
$lines[0]; # think this is right, its an array.. all arrays start at 0 not
1.. unless
# perl is funky and dont ;)


 -Original Message-
 From: Casey West [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, January 08, 2002 10:56
 To: Yacketta, Ronald
 Cc: Beginners (E-mail)
 Subject: Re: pull line #1 from a file
 
 
 On Tue, Jan 08, 2002 at 10:50:51AM -0500, Yacketta, Ronald wrote:
 :
 :Folks,
 :
 :need some minor help here.. been looking in the Cookbook for 
 an example
 :to pull the first line from a file..
 
   open FILE, filename or die $!;
   my $line = FILE;
   close FILE;
 
 Remember, FILEHANDLE is something you can iterate over.  In scalar
 context it returns just one line (for all intents and purposes) at a
 time.
 
   Casey West
 
 -- 
 Usenet is like Tetris for people who still remember how to read. 
   -- Button from the Computer Museum, Boston, MA
 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: your my last hope on this cgi programming question

2002-01-07 Thread John Edwards

You should start out by investigating the CGI.pm module for Perl. Does your
web host allow Perl scripts and do they have the CGI.pm module available for
use?

Once you've got some simple CGI scripts up and running it isn't too hard to
do what you are after. You just need to use CGI.pm to display a form, then
when that form is submitted, store the results. For some pointers, take a
look at this site.

http://www.devdaily.com/Dir/Perl/Articles_and_Tutorials/CGI/

HTH

John

-Original Message-
From: Hockey List [mailto:[EMAIL PROTECTED]]
Sent: 07 January 2002 15:03
To: [EMAIL PROTECTED]
Subject: your my last hope on this cgi programming question


I posted this in a perl forum and was told you all
might be able to help..

I was hoping you might point me in the right direction
on a pretty simple problem. I have spent days just
trying to see HOW to get this done, let alone doing
it. This seems so damn simply but Im running into a
brick wall.

I dabble in Visual Basic, but I am by no means a
'programmer'. Im a hockey player and  I have built a
website for some friends of mine and I would like to
be able to update some stats.

If you have a moment, Please take a look at
http://www.goaliebrotherhood.com and go to the members
stats page. You see my friends and myslelf listed,
along with our stats.

Here is my question: How hard would it be to provide
some input window so that this each of us could update
our stats? Like I said, I dabble in VB and is seems
pretty simple. But I dont know anything about CGI or
Pearl... I am willing to learn, like I said, this
doesnt sound like a mammoth udertaking to me. Its
pretty simple.

GP = Games played.. just goes up by 1 each update. W +
L + T = GP
W/L/T = Win, Loss, Or Tie... Probably a radio button
and then each value goes up by one, depending on which
button is selected.
GA = Goals Allowed(not seen).. Total goals allowed in
all games. the goals you let in.. Input box adds to
the total each update.
GAA = Goals Against Average.Total Goals Against
divided by games played.

Obviously, there would have to be some way to input
which user you, are, a password enter field and a
button to clear the stats at the start of a new
season... Possibly a way to change your password, then
I would need a way to add a new user.. I actually did
get that part built. Check out the site. Pretty
simple, right... WRONG

First, I started looking for something remotely hosted
that I could just hook up. It doesnt exist. while its
really simple. its pretty specific to a small niche of
people (hockey goalies) and I cant find anything that
will do it. So I started learning cgi. how hard can it
be to make something this simple? well, I started to
get the jist of cgi and found out that my website host
(freeservers.com) wont let me into the cgi-bin.. so
now I not only need to learn cgi and program the damn
thing.. but I need to find a place that will give me a
bin, if that exists.

Anyway. Thats my dilemma, If you know a good site that
can teach me how to do this, I would really appreciate
hearing about it. funny thing is, even after all this
headache.. I still think this will be better than
updating by hand, like I have been doing..

Thanks in advance.

-Michael #39
http://www.goaliebrotherhood.com
[EMAIL PROTECTED]








=
The Goalie Brotherhood:
http://www.goaliebrotherhood.com

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: @$

2002-01-07 Thread John Edwards

It means treat the value in $row as a reference to an array. If you print
out $row you will get something that looks like this.

ARRAY(0x369ab0)

Try altering your code to this

foreach $ts ($te-table_states) {
   print Table (, join(',', $ts-coords), ):\n;
   foreach $row ($ts-rows) {
my @row = @$row;

print @row;

  print join(',', @row), \n;
   }
 }

You can now work on @row within the foreach instead of the dereferenced
@$row.

-Original Message-
From: McCollum, Frank [mailto:[EMAIL PROTECTED]]
Sent: 07 January 2002 15:08
To: [EMAIL PROTECTED]
Subject: @$


What does the @$ sign indicate?  I have a value in @$row in the code below
that I want to strip out any html tags.  I tried to use s/\*\//g; but it
gives me an error (Can't modify array deref in substitution).


 foreach $ts ($te-table_states) {
   print Table (, join(',', $ts-coords), ):\n;
   foreach $row ($ts-rows) {
print @$row;

  print join(',', @$row), \n;
   }
 }


Thanks,
Frank McCollum
Bank Of America Securities, LLC
[EMAIL PROTECTED]
(704) 388-8894

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: test and question

2002-01-07 Thread John Edwards

You mean the timestamp on the file?

http://www.google.com/search?sourceid=navclientq=perl+read+file+timestamp

To compare dates

http://www.google.com/search?sourceid=navclientq=perl+compare+dates

HTH

John

P.S If you ask a question on the list, you should be prepared for the answer
to go back to the list, not diectly to you alone. This is a forum for
sharing questions and answers, not a hook-up for one-to-one help.
http://learn.perl.org/beginners-faq

-Original Message-
From: Alex Harris [mailto:[EMAIL PROTECTED]]
Sent: 07 January 2002 15:21
To: [EMAIL PROTECTED]
Subject: test and question




I just joined and have a newbie question.  How can I read in the date of a 
file (mmdd) AND then compare that to another date in Perl?  I'm running 
of and AIX Unix machine.  Please email me direct at [EMAIL PROTECTED]

_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Searching for a book...

2002-01-07 Thread John Edwards

Try to keep lines shorter? I think Stanislav's post was more than adequate
for the list. Especially as it would appear that English isn't his first
language.

Take a look at the FAQ section 2.3, bullet point 1 and chill out.

/John ;)

-Original Message-
From: Jon Molin [mailto:[EMAIL PROTECTED]]
Sent: 07 January 2002 16:32
To: Stanislav Zahariev
Cc: [EMAIL PROTECTED]
Subject: Re: Searching for a book...


Stanislav Zahariev wrote:
 
 Hello,
 I'm searching for a perl book to buy... But I'm not sure which is the
best, or which are the best. Can you refer me some so I can chose from them?
I know the basic things of perl, if the book holds them they must be very
detailed. I'm oriented in programming net stuffs with perl. Thanks in
advance.

take a look at http://learn.perl.org/ and try to keep lines shorter

/Jon

 

best regards,

sofit

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: HELP - finding a float while reading a file

2002-01-04 Thread John Edwards

123 45 -23 56 -3.45
145 555 112  -12.0 -2.55

From those lines, is it just the -3.45 and -2.55 that you are after? If so
then the following should work.

my @lines = ('123 45 -23 56 -3.45', '145 555 112  -12.0 -2.55');

foreach (@lines) {
/(-?\d*\.?\d+)$/;
print Found $1\n;
}


The regex /(-+\d+\.+\d+)$/; breaks down in the following way.

() store the value found in the special $1 variable/
-+ Look for 0 or 1 instance of the - sign
\d* Look for 0 or more digits
\.? Look for 0 or 1 decimal point
\d+ Look for 1 or more digits
$ match the end of the string, so the match found must appear at the end of
the string of data. This is probably where you were going wrong before.

HTH

John

-Original Message-
From: Nestor Florez [mailto:[EMAIL PROTECTED]]
Sent: 04 January 2002 02:26
To: [EMAIL PROTECTED]
Subject: HELP - finding a float while reading a file


Hi there,

I am trying to read a file and find the last numeric value in the line read.
example:
123 45 -23 56 -3.45
145 555 112  -12.0 -2.55

all of the values are separated by a space and I am looking for the last
value.
I tried

$_ = s/[-][0-9].+$/$1/;
$number = $1;

The problem is that, not aleways I am getting the last value starting at the
negative value.
Somtime I get the second to last value.

Thanks in advance,

Nestor :-)


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Computer connected to the internet?

2002-01-04 Thread John Edwards

How about pinging several hosts that have a pretty good chance of being up.
www.microsoft.com, www.netscape.com, www.ibm.com, etc, etc. You could also
ping your local gateway address. If all fail (except for the router as the
link may be down beyond that, but if the ping to the router fails, then you
are definetly without connection) then you could assume you've lost
connection.

John

-Original Message-
From: Gary Hawkins [mailto:[EMAIL PROTECTED]]
Sent: 04 January 2002 12:24
To: [EMAIL PROTECTED]
Subject: Computer connected to the internet?


How can I check whether the system is connected?

Want to pause the script if connection is lost.  

/g



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: add text to the end of a word. HELP!!

2002-01-02 Thread John Edwards

You need to open the file, save the contents in memory, then close the file.
Now re-open the file for writing and print the saved contents to it making
the changes as needed. This is fine for non crictical files that are small
(once you open the file for write, it's contents are deleted so if your
script crashes you lose the file completely).

For more safety and for bigger files, open the file and create a new file.
Write the contents of the old file to the new file one line at a time,
making the changes as needed. When that has finished, rename the old file to
oldfile.bak, then rename the new file to whatever the old one was called.

HTH

John

-Original Message-
From: Ahmed Moustafa [mailto:[EMAIL PROTECTED]]
Sent: 02 January 2002 02:31
To: [EMAIL PROTECTED]; Leon
Cc: [EMAIL PROTECTED]
Subject: Re: add text to the end of a word. HELP!!


Leon,

I've tested reading and writing from the same file and it didn't work. I 
  think that can't be done in any language.

Leon wrote:

 - Original Message -
 From: Ahmed Moustafa [EMAIL PROTECTED]
 Newsgroups: perl.beginners
 To: Leon [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 
Can you open a file for reading and writing as the same time?

 
 I have asked the question of can I read and write to the same file
 simultaneously, such as this :-
 open FILE, 'myfile.txt' or die $!\n;
 open FILE2, 'myfile.txt' or die $!\n;
 while (FILE){
 # do some changes to $_;
 print FILE2 $_;
 };
 
 but I did not get any response. Therefore I dont think we can do that.
 
  end of msg -


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Cant figure out how key's value in a hash is created in program example.............

2001-12-20 Thread John Edwards

I'll try

$count {$word} = $count {$word} + 1;

The $count refers to a hash called %count. As you are working with only one
element of that hash (the key/value pair with the key of $word), you
reference the element as a scalar (hence the $, not %). It's still refering
to the hash, but not the whole hash, just the key/value pair with a key
called $word.

The line is taking the value of the key named $word in the hash called
%count and adding one to that value.

Here is a little walkthrough.

# Create an array with the word list
@words = qw(perl learning perl book car book perl fish);

# iterate through the array, counting the instances of each word
foreach $word(@words) {
# This is the same line as you are having problems with
$count{$word} = $count{$word} + 1;
}

On the first iteration, $word = perl, so a hash called %count is created
(as there isn't one already). The line

$count{$word} = $count{$word} + 1;

can be rewritten as

$count{'perl'} = $count{'perl'} + 1;

The value of $count{'perl'} is zero as it has just been defined, 0 + 1 = 1
so a key/value pair is created in the hash which looks like this.

%count = (  'perl' = 1 );

next iteration, $word is learning. %count exists, but the key of 'learning'
doesn't. The has now looks like this

%count = (  'perl' = 1,
'learning' = 1 );

third iteration, $word = 'perl' again. That key already exists in the hash,
so the line

$count{$word} = $count{$word} + 1;

could be rewitten as

$count{'perl'} = $count{'perl'} + 1;

$count{'perl'} = 1, as this was stored in the hash before, so it now looks
like

$count{'perl'} = 1 + 1;

The hash is now updated to look like this

%count = (  'perl' = 2,
'learning' = 1 );

and so on...

Once you're done counting the words you can print out the values stored in
the hash to get the results.

foreach $key (sort keys %count) {
print $key found $count{$key} times\n;
}

This is assigning the name of the keys in the %count hash, sorted in order,
to $key on each iteration. The print line then prints the name of the key,
and the value by returning to the hash to lookup the value it is storing for
the key called $key.

Hope this is clear and of some use. Good luck learning Perl.

John

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 20 December 2001 11:53
To: [EMAIL PROTECTED]
Subject: Cant figure out how key's value in a hash is created in program
example.


Hi there,

Very new to PERL (chapter 5 Learning PERL edition 2!!) but I am determined
to master this!! Or at least be good at it!!

I'm having trouble grasping the code below. I know it's a small snippet but
I think it's important.

Can you please explain the $count variable and how the %count came about?

chomp (@words = STDIN); # I understand this line as in you are reading in
all the words

foreach $word (@words){ # for every element of the array @words..
 $count {$word} = $count {$word} + 1; # or $count {$word}++ # I get a
bit lost here!! Is $count the value of the key $word in a hash?
}

foreach $word (keys %count) {#How did %count come about?
 print $word was seen $count {$word} times\n;
}

Thanks again
B


**
The contents of this email and any attachments are confidential.
It is intended for the named recipient(s) only.
If you have received this email in error please notify the system manager or
the 
sender immediately and do not disclose the contents to any one or make
copies.

** eSafe scanned this email for viruses, vandals and malicious content **

**


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Shift question...

2001-12-20 Thread John Edwards

shift returns the first value of the array. When no array is defined it
operates on the default array @_

You will most likely see the line you mention as the first line of a
subroutine. E.g

call_sub('John');

sub call_sub {
my $name = shift;
print Name is $name\n;
}

What's happening here is that the value passed to the subroutine call_sub is
stored in a locally scoped default array for that subroutine. When you
perform a shift on the array it returns the data passed. This is stored in
the local $name scalar for use within the subroutine. Some other ways you
may see this written are

my $name = $_[0];   # Uses a direct route to the first element of the
array
my ($one, $two) = @_; # When passing more than one value to the subroutine,
assign them to two different scalars within the array

HTH

John

-Original Message-
From: Wim De Hul [mailto:[EMAIL PROTECTED]]
Sent: 20 December 2001 15:48
To: [EMAIL PROTECTED]
Subject: Shift question...


Hello guys ( and girls),

While I was reading a script, I saw the lines:

my $var = shift;

I thought that shift puts a variable in an array? What does this mean?

Thanks,

Wim.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




  1   2   3   >