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;
}
-
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)$/) {
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
: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
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
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]
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
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
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
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"
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
#!/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 `$['
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
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
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
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
>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: [
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 -
>
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
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---
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
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
$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,
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
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
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
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
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
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
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
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
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
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.
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
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
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
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
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
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
#!/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
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
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
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
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,
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
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
46 matches
Mail list logo