RE: replacing special chars

2005-02-03 Thread Stout, Joel R
Try this, and remember - with XML there are more than one you have to change: sub xc { #returns text free of XML baddies - xc = xml clean my $data = $_[0]; $data =~ s/&/&/g; $data =~ s//>/g; $data =~ s/'/'/g; $data =~ s/"/"/g; return $data; } -

RE: Trouble with compound regular expression matching

2004-12-07 Thread Stout, Joel R
I replied directly too - sorry. Why not use a module to help out? I think it's easier to read - but then again I'm no perl expert... use File::Basename; $fullname = "/usr/local/pics/sample.tiff"; #for example ($file,$dir,$_) = fileparse($fullname, qr/\..*/); if (/\.(tif|tiff|jpg|jpeg)$/) {

RE: time managing

2004-09-15 Thread Stout, Joel R
Microsoft Scheduler also sucks but not quite as bad as "at". I'd look into the Windows Cron first but you can also run a daemon (below). #your shebang use strict; use POSIX; # Start the loop for the daemon while(1) { my(@now) = localtime(); my($today) = POSIX::strftime( "%m

(OT) RE: Microsoft Word Creation // CSS

2003-10-07 Thread Stout, Joel R
:italic; } H3 { color:blue; font-family:Garamond; font-size:30pt; font-style:italic; } --> Help Help Help -Original Message- From: John [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 07, 2003 8:53 AM To: Stout, Joel R; Perl Beginners Subject: Re: Microsoft Word Creation

RE: Microsoft Word Creation

2003-10-07 Thread Stout, Joel R
Good place to ask. Jenda and some others are great with perl and M$. One thing I've done in the past is to write HTML but save it as a *.doc. Example: Open a file and write: testtest test test Save it as test.doc. Open it in Word. It show the formatting. The user can then edit and save as a

RE: Perl on-line books

2002-07-22 Thread Stout, Joel R
I would check to see if this copy is legal before sending out the link again. ~Some~ Russian sites put pirated copies of books online. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: scheduler question - newbie script

2002-05-29 Thread Stout, Joel R
Depending on how long the job takes, this little script runs about every 10 seconds. If you want to be more exact I think you'll have to fork. #!/usr/bin/perl -w use strict; use POSIX; # Start the loop for the daemon while(1) { my(@now) = localtime(); my($today) = POSIX::str

[OT] Regional bragging was RE: Fixing the Quality of our OldBies was Re: GoryDetails on: err or log message

2002-04-29 Thread Stout, Joel R
Easy for you to say...you don't live in Portland where we have the finest beer in the world. :) J -Original Message- From: Timothy Johnson [mailto:[EMAIL PROTECTED]] Sent: Monday, April 29, 2002 9:53 AM To: '[EMAIL PROTECTED]' Subject: RE: Fixing the Quality of our OldBies was Re: GoryD

RE: RegEx question

2002-04-23 Thread Stout, Joel R
Just translates your "+" to " ". my ($key); $key = "one two three+four"; $key =~ tr/+/ /; print "$key\n"; one two three four -Original Message- From: Ron [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 23, 2002 11:18 AM To: [EMAIL PROTECTED] Subject: RegEx question I have been usi

RE: Incrementing the letters in an array

2002-04-18 Thread Stout, Joel R
Adding one and incrementing are different. You're adding 1. Did you try incrementing the character? Instead of this: $code[$y]=$code[$y]+1; try ($code[$y])++; #!/usr/bin/perl @code = qw( A B C D ); $y = 0; if( $code[$y] ne "F" ){ print "$code[$y]\n"; ($code[$y])++; print "$code[$y]\n"

Install question XML::SimpleObject

2002-04-04 Thread Stout, Joel R
I have XML::SimpleObject in one of my scripts. At that time it required XML::Parser, which is fine because XML::Parser comes with ActiveState so I'm cool. It was installed some time ago and runs great. But now I'm setting up another machine. When I try to install XML::SimpleObject it says: Ch

RE: string indexing

2002-03-04 Thread Stout, Joel R
#!/usr/bin/perl -w my $x = "abcd"; print substr($x,3,1); from perldoc perlfunc: substr EXPR,OFFSET,LENGTH,REPLACEMENT substr EXPR,OFFSET,LENGTH substr EXPR,OFFSET Extracts a substring out of EXPR and returns it. First character is at offset `0', or whatever you've set `$['

RE: network file directories and directory names with spaces

2002-02-28 Thread Stout, Joel R
again with all the backslashes... This works on windows: opendir(DIR,"C:/program files"); my @files = readdir(DIR); print @files; J:) > -Original Message- > From: Timothy Johnson [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 28, 2002 12:58 PM > To: 'Eric Peers'; [EMAIL PROTECTE

RE: Storing Newsletter in Database

2002-02-19 Thread Stout, Joel R
Any thought to storing links to the docs in a db rather than the data itself, maybe with some keywords you can search on? Joel Headline- Apathy Runs Rampant; But Noone Seems to Care > -Original Message- > From: Timothy Johnson [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 19, 2

RE: can't print input argument

2002-02-12 Thread Stout, Joel R
try: perl program.pl file.txt and then check $ARGV[0] It should contain "file.txt". I've dealt with this before using Windows and line args. Anyone more experienced (Jenda?) can help out more. J > -Original Message- > From: Wagner-David [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, Fe

RE: PERL and XML Parser

2002-02-01 Thread Stout, Joel R
I not sure how more experienced Perl developers feel but in addition to XML::Parser, I found XML::SimpleObject a great way to start parsing XML. Here's a link: http://www.xml.com/pub/a/2001/04/18/perlxmlqstart1.html Additionally, you can model the data anyway you want, but here's a little twis

RE: int()

2002-01-17 Thread Stout, Joel R
>From previous post: $q = int( $p ); # goes towards zero $r = ceil( $p );# goes to next highest integer $s = floor( $p ); # goes to next lowest integer > -Original Message- > From: Naveen Parmar [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 17, 2002 2:15 PM > To: [

RE: Help with clearing an array

2002-01-14 Thread Stout, Joel R
perldoc perldata says for clearing arrays: @array = (); or... $#array = -1; > -Original Message- > From: Leon [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 15, 2002 8:19 AM > To: [EMAIL PROTECTED] > Subject: Re: Help with clearing an array > > > - Original Message - >

RE: deleting lines in file

2002-01-14 Thread Stout, Joel R
Got this from a merlyn post, while () { next if 1..10; print OUT_FILE $_; } > -Original Message- > From: Cabezon Aurélien [mailto:[EMAIL PROTECTED]] > Sent: Monday, January 14, 2002 12:56 PM > To: [EMAIL PROTECTED] > Subject: deleting lines in file > > > hi, > i wonder how to dele

RE: interesting JAPH, how does this work?

2002-01-10 Thread Stout, Joel R
Readability wasn't a concern with making this obfu. I did want to show that it worked with "use strict;" so I put that on a seperate line. Original Monks post below. Joel Calaban on Monks #!c:\perl\perl.exe -w use strict; my $A="a";for(0..285074){$A++;}print"$A"; > -Original Message---

RE: perl sleep

2002-01-07 Thread Stout, Joel R
Here a little daemon that runs my Perl FTP program with different job cards. It runs every 5 minutes. #!/usr/bin/perl -w use strict; use POSIX; # Start the loop for the daemon while(1) { my(@now) = localtime(); my($today) = POSIX::strftime( "%m/%d/%Y", @now); my($ti

RE: EXCEL automation

2002-01-07 Thread Stout, Joel R
Not sure, but if you go to Window -> Unhide you can see that the book was created successfully. Maybe a Win32 Perl Guru can help more. Joel > -Original Message- > From: Billie [mailto:[EMAIL PROTECTED]] > Sent: Monday, January 07, 2002 7:15 AM > To: [EMAIL PROTECTED] > Subject: EXCEL au

RE: Happy New Yr Y2K+2 =) Spliting Question

2002-01-03 Thread Stout, Joel R
$a = "1234:4321;abcde;fghij::;klmno"; @dataLine = split(/;/, $a, 2); ($x, $y) = split (/:/, $dataLine[0]); print "x: $x\n"; print "y: $y\n"; print "rest: $dataLine[1]\n"; see split in perldoc perlfunc > -Original Message- > From: Curtis Poe [mailto:[EMAIL PROTECTED]] > Sent: Thursday,

RE: Array Length.

2001-12-17 Thread Stout, Joel R
Assigning the array to a scalar will give you a count: push ( @initial_array, qw( apple orange bananna )); $a = @initial_array; print $a; prints 3 -Original Message- From: Ryan Guy [mailto:[EMAIL PROTECTED]] Sent: Monday, December 17, 2001 12:24 PM To: '[EMAIL PROTECTED]' Subject: Array

RE: Send e-mail attachment // A little help and a little help

2001-11-27 Thread Stout, Joel R
I'm still a real beginner and think Mail::Sender is about as easy as it gets... Since the subject has been brought up, pls take a look at my simple sub for emailing files. I know this code works but can be improved. I send the file name(s) to be attached, a file name for the message text, and

RE: Off-Topic (200%) - Where are you from?

2001-11-09 Thread Stout, Joel R
Portland, Oregon -Original Message- From: Etienne Marcotte [mailto:[EMAIL PROTECTED]] Sent: Friday, November 09, 2001 7:08 AM To: [EMAIL PROTECTED] Subject: Off-Topic (200%) - Where are you from? By reading the messages everyday I can guess most of us are from United States right? And

RE: Running application

2001-10-22 Thread Stout, Joel R
or.. system("C:\\WINNT\\notepad.exe"); system("C:/WINNT/notepad.exe"); same on my box and I save myself that extra typing :) -Original Message- From: Busse, Rich [mailto:[EMAIL PROTECTED]] Sent: Monday, October 22, 2001 11:08 AM To: Perl Beginners Subject: FW: Running application Watch

RE: Fraction to integer.

2001-10-18 Thread Stout, Joel R
int will go towards zero... #!/usr/bin/perl -w my ($p, $q, $r, $s, $t); use POSIX; use strict; $p = rand( 100 ); # random number between 0 and 100 $q = int( $p ); # goes towards zero $r = ceil( $p );# goes to next highest integer $s = floor( $p ); # goes to next lowest inte

RE: Periodic Auto Start

2001-10-04 Thread Stout, Joel R
On windowsNT you can use 'Scheduled Tasks'. For example I have: C:\Perl\work\ftp\edicheck.pl /m running every night at 11:59. It will pop up a dos window and run. In the morning you can check the 'Last Result' column to make sure it ran okay, but I usually build a log file entry into my scrip

RE: PDF's on the fly... // Article "A Simple Approach to PDF"

2001-07-20 Thread Stout, Joel R
Here's an article I found a while back on creating PDF from HTML with Perl. Probably not exactly what you're looking for: http://www.stars.com/Authoring/Languages/Perl/PerlfortheWeb/index16.html Joel *You know you're bored when... my $a = ""; for (0..266796) { $a++; } print "$a\n"; -Or

RE: ActivePerl - how does one configure for HTML

2001-07-16 Thread Stout, Joel R
WinNT comes with "Personal Web Server" (PWS) which is how I'm learning Perl CGI. You can put your scripts in C:\Inetpub\wwwroot\cgi-bin. You can then run them by going to: your_homepage\cgi-bin\your_script.pl. I'm not sure if Windows 98 comes with PWS. Sorry I couldn't be of more help - just l

RE: perl as win32exe

2001-07-12 Thread Stout, Joel R
Active State has an exe-maker in their Dev Kit. I had problems with Perl2Exe, but that was probably because of my inexperience with it. I did find that their support help (at Perl2Exe) was very lacking. -Original Message- From: pete [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 18, 2

Perl 2 EXE or other problem?

2001-07-03 Thread Stout, Joel R
I have the following in my script: use Mail::Sender; When using Perl2Exe I get the following error: Warning: module Mail/Sender.config.pm not found After install of Perl2Exe I ran the sample and it did fine. The Perl script runs without warnings and I use (-w; use strict;). I am using Win32.

RE: Beginning

2001-06-29 Thread Stout, Joel R
One more note for beginners (like myself) buying Perl books - The Perl CD Bookshelf is $71.96 (USD) at Amazon and $47.97 (USD) at FatBrain.com. Shop around. (I have any no financial ties to FatBrain just looking to help the end user) -Original Message- From: Stout, Joel R [mailto

RE: Beginning

2001-06-29 Thread Stout, Joel R
Learning languages by reverse engineering does not work for most people. Try Learning Perl and the Perl Cookbook for starters. Also go to http://learn.perl.org/ Cheers, Joel -Original Message- From: Jerry Preston [mailto:[EMAIL PROTECTED]] Sent: Friday, June 29, 2001 12:16 PM To: Sco

RE: Windows Background Process

2001-06-28 Thread Stout, Joel R
I've tried what you are talking about. Specifically I wanted to run a Perl program from NT Task Scheduler in the background. The mentioned Win32::Process works (http://www.xav.com/perl/site/lib/Win32/Process.html) but... if you are trying to do it through Scheduler who'll always have at least on

XML::Parser XML::SimpleObject -> First XML parsing pls help

2001-06-13 Thread Stout, Joel R
I took the example from http://www.xml.com/pub/a/2001/04/18/perlxmlqstart1.html I wanted something really simple for XML parsing that basically just reads values. But I'm stuck (again). #Here's what I'm trying to run: #!c:\perl\perl.exe use XML::Parser; use XML::SimpleObject; use strict; my

LWP

2001-06-07 Thread Stout, Joel R
Hiya, I just started running some CGI scripts. Very cool. But I'm running into a problem both with an example in the CookBook and with a script given to me. Both use LWP so I'm thinking that I'm missing a module or something. I have the basic Active State install loaded on a WinNT book. I see

RE: Records put into a hash - Beginner Question

2001-06-04 Thread Stout, Joel R
Many thanks, one last tidbit: Is it better to : %Fields = %{$Accts{$account}}; foreach $name ( keys %Fields ) { print "$name : $Fields{$name}\n"; } or foreach $name ( keys %{$Accts{$account}} ) { print "$name : \n"; } -Original Message- From: [EMAIL PROTECTED] [mail

Records put into a hash - Beginner Question

2001-06-04 Thread Stout, Joel R
#!/usr/bin/perl -w #In page 369 of the Cookbook, I saw that they have a "person" record stored into the scalar "$Nat", like so: $Nat = { "Name" => "Guy Person", "Address" => "123 Itsgee Place", "Age" => 34, }; #Say you indexed this by $AcctNo: $AcctNo = "P123-4

Script Review

2001-05-24 Thread Stout, Joel R
Hey, I've started writing Perl a little over a month ago with the help of the awesome Llama (and this mailing list). I am only on Chapter 8 so don't bruise my fragile ego too much with this script review. It's simple data manipulation but as you'll see, I need a lot of help with the structure

matching question (real newbie...not like you fake newbies out there...)

2001-05-17 Thread Stout, Joel R
I want to get the file names of all "EDI" files from a certain directory. I do not want "ENT" (or encrypted) file names. Example: The directory contains: a001.edi a002.edi a003.edi.ent a004.EDI After getting the file name in $_ I did the following match: if (/edi\b/i) { # thinking I would

[beginner] file parsing question

2001-04-24 Thread Stout, Joel R
Sorry so lengthy but here goes: I am a Perl newbie and trying to parse a file. Depending on the tags in the data I want to parse each line a different way. I built the following program to test my process. use strict; my (@lines, $testln, @REFln); while (<>) { chomp; testType

Reference question

2001-04-23 Thread Stout, Joel R
Speaking of aging camels, is the Camel book still the best reference to have? I am new to Perl and have the Llama book. It's been a good starting place but one day I see myself moving past it. I would like something that covers the language in more detail and deals with Data Munging, XML, CGI,

RE: Stupid Hash Tricks

2001-04-20 Thread Stout, Joel R
Ok I know what it does ('cause I ran it, see below) but I still don't fully understand how. Also can you give a little insight into passing arrays to subroutines/functions. I can pass them alright but have problems accessing them. I use $_[0] but it doesn't seem to work for arrays. Any help wou

Perl FTP question [beginner]

2001-04-18 Thread Stout, Joel R
I wrote this code to email me attachments of any files found at a certain ftp site. It works but... since I'm new at Perl I know there's got to be a better way. In particular the handling the file transfer by parsing out the output from DIR seems hinky. Let me know if you can help. #!c:\perl\p