Re: append to the top of a file

2001-05-23 Thread Philip Newton
); read FILE, $var, $size, 0; You can leave off OFFSET if it's zero. Less confusing IMO, since the default case for all places I've used read uses an offset of zero. print $var; Unnecessary double quotes around $var. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own

Re: Code references

2001-05-23 Thread Philip Newton
, rather than giving them such funny names. That's what Perl has data structures for, to save people using $formfield1 through $formfield15. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're part

Re: Best way to determine that an item exists at URL?

2001-05-23 Thread Philip Newton
at least part of the document with a GET request and figure it out from the contents. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're part of the precipitate

Re: Code references

2001-05-23 Thread Philip Newton
@myarray, $ref; } Symbolic references are ick. Avoid. They often indicate a problem in your design. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're part of the precipitate

Re: Code references

2001-05-23 Thread Philip Newton
Lee Goddard wrote: From: Philip Newton [mailto:[EMAIL PROTECTED]] Rubinow, Larry wrote: Finally, a legitimate case for symbolic references? I doubt it. Having names like this for subroutines sounds strange enough; they're not very descriptive. Did you really want the full name

Re: Code references

2001-05-23 Thread Philip Newton
Lee Goddard wrote: From: Philip Newton [mailto:[EMAIL PROTECTED]] Symbolic references are ick. Avoid. They often indicate a problem in your design. Not my design - Sean Burke's MIDI::* packages, specifically MIDI::Simple::synch. I don't see where MIDI::Simple::synch requires symbolic

Re: Server Side Include Question

2001-05-14 Thread Philip Newton
of whether SSI calls Perl, C, or Bourne shell. The browser would have to fetch the document again to get any changes. If not, any suggestions. Thanks in advance. You might be able to do it in JavaScript: Load up a JS array and page through that array ten links at a time. Cheers, Philip -- Philip

Re: awk and perl

2001-05-09 Thread Philip Newton
not what you want. Are you running with -w and 'use strict'? If not, why not? Thanks for any input. HTH. HAND. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're part of the precipitate

Re: END block needed for abnormal terminations

2001-05-09 Thread Philip Newton
, on Unix, you could catch SIGTERM, SIGSEGV, and/or SIGBUS. Not sure which signals are sent by the operating system on Win32; I believe only SIGINT is emulated. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're

Re: Numbers in perl

2001-05-09 Thread Philip Newton
= join '-', ($string =~ /(...)(..)()/) Which one of those is best is up to you. The unpack looks nicest to me in this example. Hope this helps. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're part

Re: Numbers in perl

2001-05-09 Thread Philip Newton
$Bill Luebkert wrote: You could use substr or a pattern match or ??. substr is probably faster than RE. And unpack possibly clearer. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're part

Re: Logic Question

2001-05-03 Thread Philip Newton
= 0; foreach $item ( whatever() ) { print $item; $i++; print \n if $i % 2 == 0; } Or something like that. Can easily be adapted to after every third, eighth, nth item by changing the modulus. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own

Re: re-evaluate as a scalar

2001-05-03 Thread Philip Newton
= q(Isn't this a nice $one!); ... print eval $two; Or you could use a function call instead of a string: my $one; sub what's_one_now { return Isn't this a nice $one } ... print what's_one_now; Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All

Re: Get a process' exit value when using open() to pipe the process' output?

2001-04-26 Thread Philip Newton
the command returned. (You'll probably still have to divide by 256, just like with the return value from system.) Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're part of the precipitate

Re: Rand on win2k

2001-04-26 Thread Philip Newton
device) or based on the current time and process ID, among other things. I'd say that's pretty good without trying to come up with a decent srand() seed yourself. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're

Re: using keys() on second dimension of 2-D associative array?

2001-04-18 Thread Philip Newton
to its arguments, so if it were a hash, you'd see a hash in list context -- which is a list of (key, value) pairs. As Joe Discenza said, you need to dereference the reference (in this case, with %{ ... }). Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's

Re: bad file

2001-04-18 Thread Philip Newton
Mike Nolen wrote: Any way to have Perl read Unicode? I've heard good things about Unicode::String. The format you want to convert from sounds like UTF-16; the format you want to convert to is perhaps latin1 (which is very similar to the Windows "Western" codepage). Cheers, Philip

Re: Reading in files from a SGI

2001-04-17 Thread Philip Newton
feedback? People do it all the time to have a script return an image. For example, quite a lot of adserver code does this; try looking for something like img src="http://www.example.com/adserver.pl?site=daveswebsitex=480y=60id=48fb 29a" -- where the image tag references not a static i

Re: strip empty lines from a files

2001-04-17 Thread Philip Newton
bably faster to check for *one* non-space character than to see whether there are *only* space characters in the line. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution,

Re: Unicode and mails

2001-04-03 Thread Philip Newton
and declare a charset of UTF-8 or UTF-7, with an appropriate Content-Transfer-Encoding (probably 7bit for UTF-7 and base64 for UTF-8). Then encode your message contatining chr(8220) in UTF-7 or UTF-8. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're

Re: template problem

2001-04-03 Thread Philip Newton
'}. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're part of the precipitate. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com

Re: request help tcp to mysql

2001-04-03 Thread Philip Newton
to win32 it's a problem if (-f "tele.conf") { eval `cat tele.conf`; do 'tele.conf'; Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're part of the p

Re: printing ($refname)-{$key} doesn't work

2001-03-28 Thread Philip Newton
}); And in any case, how come print ($ref)-{eggs}, "aa\n"; doesn't print out the "aa\n" at the end, just the hex hash value? Because the arguments to print are only $ref. The return value of print is subscripted with {eggs}, and then "aaaaa\n" i

Re: use vars applies outside of a file?...

2001-03-22 Thread Philip Newton
est.pl, Perl has already seen the "use vars" declaration for $x. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're part of the precipitate. ___ Perl-Win32-

Re: use vars applies outside of a file?...

2001-03-22 Thread Philip Newton
etely gone, nor is its value clobbered. It's only invisible through the name $x until the end of the current block of file.) Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're part of the p

Re: Extracting *.doc data

2001-03-19 Thread Philip Newton
er. If you're interested, you could get in touch with Honza Pazdziora. I think his address is: [EMAIL PROTECTED] (at least, it used to be). He also presented a short paper on this at yapc::Europe 19100 in London. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my

Re: Striping trailing and proceeding white spaces

2001-03-12 Thread Philip Newton
h a couple of additional suggestions. Please grep the FAQ or try `perldoc -q keyword` on a few keywords that come to mind before asking. :-) Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're part of the p

Re: DBD::mysql binary

2001-03-12 Thread Philip Newton
Onward wrote: does anyone know where i can get a dbd::mysql binary install module? I got mine from ActiveState: `ppm install DBD-Mysql` I think was what did it. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution

Re: Inconsisten ARGV handling on Win32 Solaris

2001-03-08 Thread Philip Newton
also knows about `command` and 'text with spaces'. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're part of the precipitate. ___ Perl-Win32-Users mailing list [EMAIL

Re: Inconsisten ARGV handling on Win32 Solaris

2001-03-08 Thread Philip Newton
at http://Jenda.McCann.cz/#G . Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're part of the precipitate. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http

Re: What's wrong w/ my script?

2001-02-28 Thread Philip Newton
tories are separated with '/'.) From `perldoc File::Find`: `$File::Find::dir' contains the current directory name, and `$_' the current filename within that directory. `$File::Find::name' contains the complete pathname to the file. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinion

Re: setting a variable in another namespace

2001-02-28 Thread Philip Newton
alized # value in print" under -w Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're part of the precipitate. ___ Perl-Win32-U

Re: simple area code changing script

2001-02-23 Thread Philip Newton
-- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you're not part of the solution, you're part of the precipitate. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl

Re: File Find Expression inside RexExp?

2001-02-16 Thread Philip Newton
alues? Then you should say so. print '@File = ' , "@File\n"; This will print out the members of @File, separated by spaces (or the value of $"). This may or may not be what you want. Cheers, Philip -- Philip Newton [EMAIL PROTECTED] All opinions are my own, not my employer's. If you'

Re: email validation?

2001-02-14 Thread Philip Newton
Aldo Calpini wrote: Joe Schell wrote: 'Proper' being as defined in all of the relevant RFC's - presumably including email comments and the older formats? If so then you might wish to create a module. I don't believe one currently exists that correctly checks the format. it does.

Re: comparing a read number to a number in a for loop

2001-02-06 Thread Philip Newton
$Bill Luebkert wrote: Niklas Strömbeck wrote: I'm really fresh in programming. I'm reading a number from a file using a for-loop. Everything works except that I can't compare the value of the loop ($chh) with the read value ($hh) in the following if-loop. chomp the read number to

Re: RegExp Question

2001-02-05 Thread Philip Newton
John Giordano wrote: $grep_deferred = system ('findstr DeferredStatus response1'); print "$grep_deferred\n\n"; [snip] $grep_deferred has this in it: a href="/c9410ee04de9845704db8951dfde015b/DeferredStatus"img src="/images/btnstats.gif" width=120 height=40 border=0 alt="Mail Status"/a

Re: Version Number of Package

2001-02-01 Thread Philip Newton
Purcell, Scott wrote: How does one get the version of a installed package? EG. If I want to know which version of the DBI I have, what do I do? This often works: perl -MMy::Module -e "print $My::Module::VERSION" , since, by convention, modules contain a variable $VERSION containing the

Re: Post in Plain Text, Puleeeze!

2001-01-29 Thread Philip Newton
William A. Jones wrote: There are some unfortunate people (why did they enroll on this list anyway!?!) who are using AOL 6.0 -- which has a problem (among many): there is no option to compose text-only email. Eep. That's completely and utterly broken. For example, it makes it impossibly to

Re: Using the system function

2001-01-29 Thread Philip Newton
Carl Jolley wrote: On Fri, 26 Jan 2001, White, Velmond wrote: I am trying to execute another script from within a script using the "system" function as follows: system("name.pl"); The name.pl does not execute. Both the calling script and the called script are located in the

Re: Regexp?

2001-01-23 Thread Philip Newton
Cornish, Merrill wrote: In list context, m//g returns a list of all matches. You could count the elements in the list. For example, like this: $count = () = $string =~ /foo/g; The assignment to () (empty list) puts the match in list context, and the scalar assignment then counts how

Re: The Perl Journal is dead :(

2001-01-17 Thread Philip Newton
Dietmar Maurer wrote: From http://news.perl.com I think that should be http://news.perl.org/ instead. Cheers, Philip ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Re: How do you change directory permanently?

2001-01-17 Thread Philip Newton
Robert Davis wrote: I am using win32:SetCwd and it sets the current working directory for the life of the perl program. So should chdir(), which is built into Perl. How do I make that change permanent so that once I exit the directory is changed? perldoc -q "changed directory" The real

Re: How do you change directory permanently?

2001-01-17 Thread Philip Newton
e batch file and sees the new CD command and executes it. Very, very ugly. I do not recommend this kind of thing. But it should work (if (2) above is true -- it used to be but I don't know whether it still is). Cheers, Philip bob Philip Newton wrote: Robert Davis wrote: I am using win3

Re: url encoding

2001-01-11 Thread Philip Newton
Doug Brewer wrote: where can i find a module/script/whatever that will encode URLs? so that "my directory" becomes "my%20directory"?? URI::Escape . I believe this is part of LWP -- you may have to 'ppm install libwww-perl' rather than 'install URI-Escape'. Cheers, Philip

Re: url encoding

2001-01-11 Thread Philip Newton
$Bill Luebkert wrote: Doug Brewer wrote: where can i find a module/script/whatever that will encode URLs? so that "my directory" becomes "my%20directory"?? URI::Escape or just code it (from URI::Escape docs): $string =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; He wants it the other

Re: GD png colours (printed)

2001-01-09 Thread Philip Newton
Nick wrote: I am creating graphs as PNGs using GD, all works fine and the graphs look great inthe browser but when printed the colours are wrong eg green background with red lines instead of white background with black lines. Could be something I've missed but I am scratching my head and

Re: compression

2001-01-09 Thread Philip Newton
Carlo wrote: I am compressing an archive using use Archive::Zip ; use Archive::Zip::Tree; and it works but let say that i do not want to compress files with extention *.exe. so if I am adding a directory $zip1-addTree( How can I exclude the files *.exe from the compression.

Re: Comparing dates

2000-12-14 Thread Philip Newton
Alloun, Jonathan wrote: Is there a module out there that will compare two dates?? Probably. There's tons of Date modules out there. Maybe Date::Calc or Date::Manip. For example: (date format is dd mm ) I have one date in a file: 10 12 2000 and another passed into the script which I

Re: Calling a PERL script within a PERL script

2000-12-14 Thread Philip Newton
Jonathan, why do you seem to send all you messages with "Importance: high" and "X-Priority: 1"? Do you think you're special or all your messages are more urgent than other people's? Crying "wolf" like this gets old after a while. Alloun, Jonathan wrote: I need to call a PERL script from within

Re: printer device control

2000-12-12 Thread Philip Newton
john z wrote: what are the preferred methods for controlling output to a printer with perl. for example, if you wanted to print a string 'hello' at a position of 1.5 inches down and 2 inches right, what could you do. Read your printer's manual and output the correct escape sequences to the

Re: Question on Arrays and Push

2000-12-07 Thread Philip Newton
Carl Jolley wrote: To print one element per line, here is one method: print join("\n",@foo),"\n"; Here's another: print join("\n", @foo, ''); The latter form may also come in handy if you're building up a string, since you can't say $output = join("\n",@foo), "\n"; (Well, you

Re: Net::SMTP

2000-12-07 Thread Philip Newton
Flynn, Timothy J wrote: Is there another smtp-command that I should be using to protect against this action, should I filter the ":", or should I use a different mail sending module. You should terminate the header properly. for ($i = 0; $i scalar(@EMAIL_LIST);$i++){ $smtp =

Re: Help with or

2000-12-04 Thread Philip Newton
Rubinow, Larry wrote: Cleaner and easier would be if( grep {/^$code$/} qw(APM CHN CN MN N NP NPR NRN NS PMD RNR SCI) ) I think you want /^\Q$code\E$/, or else A.M will work, or probably also \w+ . Cheers, Philip ___ Perl-Win32-Users

Re: how to check for busy file

2000-12-04 Thread Philip Newton
Charles Maier wrote: check the filesize. If it is being written as a new file... its size will be reported as 0 bytes. Are you sure? When my FTP client is downloading a file, I can see the file size in Windows Explorer or Servant Salamander (a Norton Commander clone) increasing as more and

Re: STDOUT as a file

2000-12-04 Thread Philip Newton
$Bill Luebkert wrote: open OUT, "$filename" or die ... print OUT ... close OUT; And if Scott wants to reopen STDOUT just to avoid having to type "print OUT blabla" all the time, there's still one-arg select: open OUT, "$filename" or die ... select(OUT); print

Re: HTML::TokeParser anaomaly

2000-11-23 Thread Philip Newton
Lee wrote: There follows some i/o from the same input string, an HTML file which as ben subject to join //,@html; and s/[\r\f\0\n]/ /g; Completely unrelated, but what the hey -- do you read in the file as @html = FILE and then $string = join '', @html? Why not read the file into $string

Re: Using Sendmail - inserting html isn't rendered

2000-11-22 Thread Philip Newton
byron wise wrote: I am able to send mail using Sendmail with no prob. But now I want to insert html tags to change color of text, make things bold, even give a background color. When I put them in as I would imagine the tags show up in the body..not rendered at all. Is there a fix?

Re: DBI using cursors

2000-11-22 Thread Philip Newton
barons wrote: I have my Perl script set up to page through recordsets. 10 pages at a time. My SQL call is something like this. SELECT column1, column2 FROM table. Now each time the next or prev button is pressed this SQL call is executed and searches through the table to find where it

Re: Diff in Perl?

2000-11-15 Thread Philip Newton
Lee wrote: What is the best means you found of running a diff on two text files to return differences/locations of? This is under Perl5.6, Win98/2000, and time preasure. Not the best, but using native tools: "fc" is a fairly minimal diff-like tool which you might be able to use. Try saying

PPM Request: Unicode::String

2000-11-06 Thread Philip Newton
Hi, I'd like to have Unicode::String added to the 522 PPM repository. I believe builds 6xx have Unicode support already, but I'm still using 522 here, and would like to use this module; however, it includes an XS component. Thanks a lot! Cheers, Philip

Non-ASCII characters and Net::LDAP

2000-10-31 Thread Philip Newton
How can I get German characters such as ä ö ü into LDAP using the module Net::LDAP (from the ActiveState packet perl-ldap 0.17 -- *not* PerLDAP!). What happens when I try to insert a string containing a non-ASCII character is that the string is truncated at that point. For example, if I try to

Re: NNTP-list

2000-10-26 Thread Philip Newton
[Also posted to Perl-Win32-Users] [Mike, please don't post in HTML :)] Nolen, Mike wrote: Thanks Philip. It works great. I do have one more problem though. I am calling the article() function from NNTP and it returns a reference to an array. You said a reference is a scalar, therefore, I

Re: John Giordano, Ron Riley, etc. (ASCII PLS!)

2000-10-26 Thread Philip Newton
erskine, michael wrote: -Original Message- From: Martin Moss [mailto:[EMAIL PROTECTED]] Everyone, I'm curious to other people's viewpoints regarding the html email's issue. My viewpoint: Let's have a ban on html postings. I agree :). And encourage good quoting (your

Re: Regular expression

2000-10-25 Thread Philip Newton
Asif Kaleem wrote: I don't want to use File::Basename. Why not? It's supposedly been tried and tested; no need to re-invent the wheel (and maybe get it wrong). Cheers, Philip ___ Perl-Win32-Users mailing list [EMAIL PROTECTED]