Re: script to match a valid email id

2014-07-11 Thread Gunnar Hjalmarsson
that function would do for you. You won't easily come up with a valid address that would be rejected. But please note the discussion that followed in that old thread. They thought I ought to use Email::Valid instead. ;-) -- Gunnar Hjalmarsson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org

Re: usage of Split

2010-07-28 Thread Gunnar Hjalmarsson
you mean by that? -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: file uploader

2009-08-02 Thread Gunnar Hjalmarsson
automaticly... but I couldn't find such a thing. Which browser related file size limitations are you talking about? CGI.pm or CGI::UploadEasy allows you to set the max size to whatever value you wish. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e

Re: Best way to mix two lists

2009-07-10 Thread Gunnar Hjalmarsson
to mix two lists in this way. You can use a hash slice. @{ $data{$key} }{ @fields } = split /:/, $val; -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http

Re: Need help w/ substitute ie. s/x/y/

2009-07-03 Thread Gunnar Hjalmarsson
idea. If it's a real world thing, you most likely should use an HTML parser. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: content type headers

2009-07-02 Thread Gunnar Hjalmarsson
. What if you simply try to view an image with FF directly? http://www.example.com/images/someimage.jpg If that's not displayed as expected, there may be something with the configuration of your FF browser. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: content type headers

2009-07-02 Thread Gunnar Hjalmarsson
extension gives image/png etc. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl # This is a comment. I love comments. # This file controls what Internet media types are sent to the client for # given file extension(s). Sending the correct media type to the client

Re: question about constants

2009-06-24 Thread Gunnar Hjalmarsson
Steve Bertrand wrote: Roman Makurin wrote: On Wed, Jun 24, 2009 at 04:37:52AM +0200, Gunnar Hjalmarsson wrote: Strange. It looks like strictures and warnings are not enabled (@a and @b are not declared). Try to add use strict; use warnings; and see if that makes Perl give you

Re: question about constants

2009-06-23 Thread Gunnar Hjalmarsson
, but second doesnt. My questions are: How did you expect the second loop to work, and what output did you get? (They both worked fine for me.) -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands

Re: question about constants

2009-06-23 Thread Gunnar Hjalmarsson
Roman Makurin wrote: On Wed, Jun 24, 2009 at 03:02:00AM +0200, Gunnar Hjalmarsson wrote: Roman Makurin wrote: use constant { A = 1, B = 2, C = 3 }; @a = (1, 2, 3); @b = (A, B, C); # first loop while(my $i = shift @a) { print $i, $/ } # second loop while(my $i

Re: word substitute with character count.

2009-06-18 Thread Gunnar Hjalmarsson
length $oldword ? sprintf %-${length_old}s, $newword : substr $newword, 0, $length_old; s/$oldword/$replace/; -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h

Re: Storing a file from a cgi parameter

2009-06-17 Thread Gunnar Hjalmarsson
or what should I do in order to make it work? I suggest that you try the CGI::UploadEasy module. http://search.cpan.org/dist/CGI-UploadEasy/ -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org For additional

Re: 2 minutes and 8 second (how do i convert it to 02:08)??

2009-06-11 Thread Gunnar Hjalmarsson
Rob Coops wrote: $text = 2 minutes, and 8 seconds; $text =~ /(\d{1,2}).*?(\d{1,2}).*/; -^^ When you are extracting stuff, .* is _always_ redundant in the beginning or end of a regex. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: Can't locate HTML::Parser in @INC

2009-06-04 Thread Gunnar Hjalmarsson
the test script was run as have read access to /usr/local/lib/perl5/site_perl/5.10.0/x86_64-linux/HTML/Parser.pm ? -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h

Re: Difference between for foreach loop

2009-05-25 Thread Gunnar Hjalmarsson
. Can anyone suggest me a good url which can tell the difference between two? http://perldoc.perl.org/perlsyn.html -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h

Re: interaction with a module and http tags

2009-05-25 Thread Gunnar Hjalmarsson
tags in the sub not considered legitimate html code when the head structures are identical in both the sub and the main code? If that is true, you'd better ask W3C. It has nothing to do with Perl. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail

Re: interaction with a module and http tags

2009-05-25 Thread Gunnar Hjalmarsson
, there is no straight perl inline html. HTML is HTML, whether it is on a static page or generated by a program, e.g. a Perl program. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h

Re: interaction with a module and http tags

2009-05-25 Thread Gunnar Hjalmarsson
jm wrote: Gunnar Hjalmarsson wrote: jm wrote: seems to be some requirement for html head via a module call that's not necessary in straight perl inline html. I'm still confused about what the real problem is, but it sounds like you are on the wrong track. AFAIK, there is no straight perl

Re: Save html page using perl

2009-05-22 Thread Gunnar Hjalmarsson
Jeff Pang wrote: We use wget -p to get the page and its full dependency. You could also use LWP but that's complicated to fetch the page and all its dependency. I thought that the portable WWW::Mechanize was the way to go rather than wget when there is a need to follow links. -- Gunnar

Re: Finding all files (what I want to do)

2009-05-19 Thread Gunnar Hjalmarsson
. By writing a Perl program. Show us what you have so far, let us know which part(s) of it you find difficult, and somebody may be willing to help you fix it. Don't expect anybody to write the whole program for you for free. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: File::Find

2009-05-18 Thread Gunnar Hjalmarsson
AndrewMcHorney wrote: I looked at the documentation for this function and I find it confusing. Try File::Finder for a less confusing interface to *the module* File::Find. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr

Re: File::Find

2009-05-18 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Mon, May 18, 2009 at 19:05, Gunnar Hjalmarsson nore...@gunnar.cc wrote: AndrewMcHorney wrote: I looked at the documentation for this function and I find it confusing. Try File::Finder for a less confusing interface to *the module* File::Find. snip Huh, never looked

Re: File::Find

2009-05-18 Thread Gunnar Hjalmarsson
opendir(), readdir() and grep(). -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Array Initialization

2009-05-13 Thread Gunnar Hjalmarsson
the code is compiled so it is *not* re-run every time through the loop. is very wrong. Yep, that's it. John, honestly I thought that you had made a 'typo', and that my little snippet would be sufficient to call your attention to it. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: Help with LWP

2009-05-13 Thread Gunnar Hjalmarsson
them? -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: LWP Select Options Count

2009-05-12 Thread Gunnar Hjalmarsson
and the HTML::TokeParser docs. Also, if there are two dropdowns and the second is a dependent of the first e.g. select size then select availabe colors; how do i count the total possible combinations of those two options? Sounds like simple math to me. -- Gunnar Hjalmarsson Email: http

Re: Array Initialization

2009-05-12 Thread Gunnar Hjalmarsson
\n; ' 1 $ -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Array Initialization

2009-05-12 Thread Gunnar Hjalmarsson
John W. Krahn wrote: Gunnar Hjalmarsson wrote: John W. Krahn wrote: my() happens when the code is compiled so it is *not* re-run every time through the loop. The assignment happens when the code is run so it is re-run every time. $ perl -e ' for (1..5) { my $count; $count += 1

Re: Array Initialization

2009-05-12 Thread Gunnar Hjalmarsson
John W. Krahn wrote: Gunnar Hjalmarsson wrote: John W. Krahn wrote: Gunnar Hjalmarsson wrote: John W. Krahn wrote: my() happens when the code is compiled so it is *not* re-run every time through the loop. The assignment happens when the code is run so it is re-run every time. $ perl -e

Re: Variable in for loop is not automatically local?

2009-05-04 Thread Gunnar Hjalmarsson
question. Just wanted to mention that you basically do that with references. perl -le ' $y = green; $x = \$y; $$x = red; print $y; ' red -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail

Re: Variable in for loop is not automatically local?

2009-05-02 Thread Gunnar Hjalmarsson
ought to be implicitly localized to the loop. http://perldoc.perl.org/perlsyn.html#Foreach-Loops OTOH, I believe it's advisable to always my() declare loop variables, even if there happens to be a global variable with the same name. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin

Re: Reporting bugs

2009-05-01 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Wed, Apr 29, 2009 at 19:07, Chas. Owens chas.ow...@gmail.com wrote: On Wed, Apr 29, 2009 at 18:44, Gunnar Hjalmarsson nore...@gunnar.cc wrote: snip You are encouraged to include a patch also when submitting a bug report - I did so in the above example, btw - so I still

Re: Reporting bugs

2009-05-01 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Fri, May 1, 2009 at 10:18, Gunnar Hjalmarsson nore...@gunnar.cc wrote: I agree that perldiag says all that needs to be said. But a common way to work with perldiag is to look up cryptic error or warning messages when needed rather than using the diagnostics pragma

Re: package variables

2009-04-29 Thread Gunnar Hjalmarsson
really useful in my case.) Though I bet people will be confused in cases like perl -Mstrict -e 'local $var = 4' because quite a few people think local $foo is a declaration. I for one don't see how a more informative error message could hurt. -- Gunnar Hjalmarsson Email: http

Reporting bugs (was: package variables)

2009-04-29 Thread Gunnar Hjalmarsson
Chas. Owens wrote: 2009/4/28 Gunnar Hjalmarsson nore...@gunnar.cc: snip I believe the standard response is patches are welcome. grin Are they? The number of open or new bugs at http://rt.perl.org/rt3/Public/ makes me fear something else. ( I did submit a bug report a few weeks ago: http

Re: Reporting bugs

2009-04-29 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Wed, Apr 29, 2009 at 17:20, Gunnar Hjalmarsson nore...@gunnar.cc wrote: Chas. Owens wrote: 2009/4/28 Gunnar Hjalmarsson nore...@gunnar.cc: snip I believe the standard response is patches are welcome. grin Are they? The number of open or new bugs at http://rt.perl.org

Re: package variables

2009-04-28 Thread Gunnar Hjalmarsson
Perl requested me to do. $ perl -Mstrict -e'$var=' Global symbol $var requires explicit package name at -e line 1. Execution of -e aborted due to compilation errors. $ The wording of that error message isn't very well thought out. :( -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin

Re: package variables

2009-04-28 Thread Gunnar Hjalmarsson
Jenda Krynicky wrote: From: Chas. Owens chas.ow...@gmail.com On Tue, Apr 28, 2009 at 13:38, Gunnar Hjalmarsson nore...@gunnar.cc wrote: snip Fully qualified names do not trip strict. Which is a reason to avoid using them. I once work at a place that wrote Perl 5 as if it were still Perl 4

Re: libwww-perl library ok, but 'get' still funny

2009-04-25 Thread Gunnar Hjalmarsson
on the Services. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: \w regular expressions unicode

2009-04-22 Thread Gunnar Hjalmarsson
Stanisław T. Findeisen wrote: Gunnar Hjalmarsson wrote: Stanisław T. Findeisen wrote: Hi how to write regular expressions matching against Unicode (eg., UTF-8) strings? For instance, in my regexp: qr/^([.@ \w])*$/ Decode the UTF-8 encoded strings before applying the regex on them. $ perl

Re: libwww-perl library

2009-04-22 Thread Gunnar Hjalmarsson
host my website simply not have the library? That seems odd. It's kind of basic, isn't it? Even if libwww-perl is not among the standard modules, I believe it's included in most Perl distributions. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail

Re: \w regular expressions unicode

2009-04-22 Thread Gunnar Hjalmarsson
Stanisław T. Findeisen wrote: Gunnar Hjalmarsson wrote: What assumptions does Perl make regarding input file (i.e., the program/script file) encoding? AFAIK, it just converts the bytes into Perl's internal format, but it does not assume anything (at least not by default) with respect

Re: \w regular expressions unicode

2009-04-22 Thread Gunnar Hjalmarsson
Gunnar Hjalmarsson wrote: Stanisław T. Findeisen wrote: With use utf8 (http://perldoc.perl.org/utf8.html) one can however make them parsed (decoded) (provided they are valid UTF-8). No. The utf8 pragma is about allowing UTF-8 encoded *symbols*, e.g. variable names or subroutine names

Re: \w regular expressions unicode

2009-04-22 Thread Gunnar Hjalmarsson
. Looks like with use utf8 those string literals aren't ordinary byte strings anymore. Perhaps they are as if Encode::decode had been applied to them? Yes, it seems to be so. Please also see my reply to Chas.'s post. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: \w regular expressions unicode

2009-04-22 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Wed, Apr 22, 2009 at 15:25, Gunnar Hjalmarsson nore...@gunnar.cc wrote: snip Yeah, it looks so. With use utf8 (http://perldoc.perl.org/utf8.html) one can however make them parsed (decoded) (provided they are valid UTF-8). No. The utf8 pragma is about allowing UTF-8

Re: qx() vs backticks

2009-04-19 Thread Gunnar Hjalmarsson
R. Hicks wrote: Are there any gotchas for using qx() to run system commands versus backticks? No, it's the same thing. http://perldoc.perl.org/perlop.html#qx/STRING/ -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr

Re: Bareword Google::Adwords::Campaign not allowed while strictsubs in use

2009-04-19 Thread Gunnar Hjalmarsson
something else. Such mistakes makes me doubt the quality of those modules. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: \w regular expressions unicode

2009-04-18 Thread Gunnar Hjalmarsson
UTF-8, $utf8_encoded; print Match if $s =~ /^\w+$/; ' Match $ -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Several packages in one file, no Export possible?

2009-04-15 Thread Gunnar Hjalmarsson
the @EXPORT working. Try import Util; instead. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: how to add support of Msql and CGI in Apache

2009-04-14 Thread Gunnar Hjalmarsson
be very specific about what you have tried, which error messages you get etc. These general guidelines about asking questions on technical lists and newsgroups may be useful: http://www.catb.org/~esr/faqs/smart-questions.html -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: escaping regex to do math on backreferences

2009-04-13 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Sun, Apr 12, 2009 at 21:58, Gunnar Hjalmarsson nore...@gunnar.cc wrote: Chas. Owens wrote: my @rank = qw/ 2 3 4 5 6 7 8 9 10 J Q K A /; my @rank = qw/A 2 3 4 5 6 7 8 9 10 J Q K A /; --^ snip That depends on who you play with. Ok. Also, if you

Re: how to add support of Msql and CGI in Apache.

2009-04-13 Thread Gunnar Hjalmarsson
http://httpd.apache.org/docs/2.0/ssl/ AFAIK, MySQL is not an HTTP server configuration thing. (Do you have a Perl question?) -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h

Re: how to add support of Msql and CGI in Apache.

2009-04-13 Thread Gunnar Hjalmarsson
Gunnar Hjalmarsson wrote: Raheel Hassan wrote: I am facing problems in executing cgi programs, on Apache web server, can any body tell me how i can configure my Apache server so that it can support CGI and Msql. I also wanted to enable ssl support in the Apache server. http

Re: escaping regex to do math on backreferences

2009-04-12 Thread Gunnar Hjalmarsson
to do that? Is that even possible? I doubt it. I suggest you check out the Games::Poker::HandEvaluator module at CPAN. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h

Re: escaping regex to do math on backreferences

2009-04-12 Thread Gunnar Hjalmarsson
Chas. Owens wrote: my @rank = qw/ 2 3 4 5 6 7 8 9 10 J Q K A /; my @rank = qw/A 2 3 4 5 6 7 8 9 10 J Q K A /; --^ -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e

Re: CPAN not working for me

2009-04-11 Thread Gunnar Hjalmarsson
the install failed the first time, but have you installed the htmldoc program? To retry, I believe you first need to remove the HTML-HTMLDoc-0.10-8rfFZS directory. HTH -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org

Re: LWP

2009-04-08 Thread Gunnar Hjalmarsson
ANJAN PURKAYASTHA wrote: I have a file stored at a location: http://parent_dir/file Which among gazillion LWP options can I use to download and store the file on my machine? use LWP::Simple; getstore('http://parent_dir/file', 'file'); -- Gunnar Hjalmarsson Email: http

Re: LWP

2009-04-08 Thread Gunnar Hjalmarsson
it: use LWP::Simple; my $url = 'http://parent_dir/file'; my $local = '/path/to/local/file'; my $file = getstore($url, $local); getstore() returns the HTTP status code, so 'file' is not the most appropriate name of a variable to which the return value is assigned. -- Gunnar Hjalmarsson Email: http

Re: @array a copy of @names???

2009-04-02 Thread Gunnar Hjalmarsson
There is no reason in this case to use the character, and most Perl programmers today would say that which_element_is(dan, @names); is the preferred 'normal' way to call a function. (Others have answered the question you asked.) -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: Can't Retrieve Data From foreach block

2009-03-30 Thread Gunnar Hjalmarsson
my $fh, '', $file or die Opening $file failed: $!; my @lastnames; while ( $fh ) { my @line = split /\t/; chomp @line; # if the record has no further elements push @lastnames, $line[1]; } -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: bot trouble

2009-03-28 Thread Gunnar Hjalmarsson
Data::Dumper to extract values from it when you'd better just say: my $nick = $message-{who}; my $str = $message-{body}; Hopefully that hint helps you move forward. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr

Re: quick regex question

2009-03-25 Thread Gunnar Hjalmarsson
Rick Bragg wrote: I need a quick regex to strip out the following: Never heard of that. What is a quick regex? -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h

Re: whatz wrong here ?

2009-03-23 Thread Gunnar Hjalmarsson
. The other mistake is your use of single quotes around the ISBN. $ perl -MBusiness::ISBN -le ' $isbn = Business::ISBN-new(0-59610-206-2); print $isbn-as_string; ' 0-596-10206-2 $ -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr

Re: Editing file

2009-03-21 Thread Gunnar Hjalmarsson
Randal L. Schwartz wrote: Gunnar == Gunnar Hjalmarsson nore...@gunnar.cc writes: Gunnar Martin Spinassi wrote: Is there any way to open a file for input and output at the same time? Gunnar Yes. Open it with the '+' MODE. Gunnar open my $fh, '+', $file or die Couldn't open $file

Re: Editing file

2009-03-21 Thread Gunnar Hjalmarsson
Chas. Owens wrote: There is also the ongoing danger of putting untrusted file names in @ARGV[4], $ perl -we undef @ARGV[4] Scalar value @ARGV[4] better written as $ARGV[4] at -e line 1. $ Maybe your previous footnote style was better after all. ;-) -- Gunnar Hjalmarsson Email: http

Re: Editing file

2009-03-20 Thread Gunnar Hjalmarsson
; truncate $fh, 0; print $fh @keep; http://perldoc.perl.org/functions/open.html -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: remove the last paragraph tag and its contents

2009-03-17 Thread Gunnar Hjalmarsson
message with an appended ad, probably with varying content inside the p/p pair. If that's the case, it's probably not a disaster if it would fail occasionally, and a simple substitution may be sufficient: s,(.+)p.+/p,$1,is -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: Making Web Form Data Safe

2009-03-16 Thread Gunnar Hjalmarsson
for the message headers, there are a few things to consider. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: [Fwd: Re: Making Web Form Data Safe]

2009-03-16 Thread Gunnar Hjalmarsson
Nigel Peck wrote: Gunnar Hjalmarsson wrote: Nigel Peck wrote: I'd appreciate hearing (reading!) people's thoughts on making web form data safe for using to compose an email via sendmail. Basically, see comments in pseudo-code below, what should I be doing to the data to make it safe

Re: [Fwd: Re: Making Web Form Data Safe]

2009-03-16 Thread Gunnar Hjalmarsson
reply). Sounds pretty safe to me. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

What's up with NNTP?

2009-03-14 Thread Gunnar Hjalmarsson
The NNTP interface to this list (and possibly other @perl.org lists) seems not to work any longer. Does anybody know what the problem is? Is it a temporary thing, or has the service been permanently disabled? -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: What's up with NNTP?

2009-03-14 Thread Gunnar Hjalmarsson
Randal L. Schwartz wrote: Gunnar == Gunnar Hjalmarsson nore...@gunnar.cc writes: Gunnar The NNTP interface to this list (and possibly other @perl.org lists) seems not Gunnar to work any longer. Does anybody know what the problem is? Is it a temporary Gunnar thing, or has the service been

Re: What's up with NNTP?

2009-03-14 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Sat, Mar 14, 2009 at 17:49, Gunnar Hjalmarsson nore...@gunnar.cc wrote: snip Unfortunately not. I tried again a couple of minutes ago; nothing downloaded. :( Well, I'll stick to emails for the time being. snip Does the following work? telnet nntp.perl.org 119

Re: unable to connect to all the hosts using Net::SSH2 module

2009-03-12 Thread Gunnar Hjalmarsson
is somewhat above your head for the time being? Maybe you'd better take a step back and improve your Perl skill? -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http

Re: unable to connect to all the hosts using Net::SSH2 module

2009-03-12 Thread Gunnar Hjalmarsson
monnappa appaiah wrote: Gunnar Hjalmarsson wrote: monnappa appaiah wrote: Im sorry for starting the new threadi tried to understand the solution but i couldn't understand much from it, i have used the used eval to trap errors but after that i couldn't understand as i'm new to perl

Re: unable to connect to all the hosts using Net::SSH2 module

2009-03-11 Thread Gunnar Hjalmarsson
)* for the failures. Apply the solution you were given in the other thread. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Regex problem

2009-03-10 Thread Gunnar Hjalmarsson
not using back reference, are there a better way? I would do: if ( $a =~ /\.(?:html|jpg)$/i ) Please read http://perldoc.perl.org/perlretut.html and other appropriate docs. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr

Re: connecting to multiple hosts using Net::SSH2

2009-03-09 Thread Gunnar Hjalmarsson
Dr.Ruud wrote: Gunnar Hjalmarsson wrote: Dr.Ruud wrote: Gunnar Hjalmarsson wrote: eval { $ssh2-connect($_) }; if ($@) { warn Unable to connect host $_: $@ and next; } That is the old fashioned way. You really need to use the return value of eval to make sure. I

Warnings

2009-03-09 Thread Gunnar Hjalmarsson
. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: best variable structure that is easy to extract values?

2009-03-09 Thread Gunnar Hjalmarsson
,], }, ); This is how you now can get the link_int values for core3: print $_\n for @{ $hostnames{core3}-{link_int} }; Suggested reading: http://perldoc.perl.org/perldsc.html -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr

Re: connecting to multiple hosts using Net::SSH2

2009-03-08 Thread Gunnar Hjalmarsson
Dr.Ruud wrote: Gunnar Hjalmarsson wrote: monnappa appaiah wrote: This the error i'm getting Net::SSH2::connect: failed to connect to 10.10.10.1:22: Unknown error at connect.pl line 21 the line 21 is shown below $ssh2-connect($_) or warn Unable to connect host $_\n and next; It's

Re: Printing directory sizes

2009-03-05 Thread Gunnar Hjalmarsson
? Probably a bug in the code. ;-) Which measures have you taken to try to find the bug? -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: hashes + use constant - weird behavior

2009-03-05 Thread Gunnar Hjalmarsson
output had you expected? -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Printing directory sizes

2009-03-05 Thread Gunnar Hjalmarsson
in my Perl installation is:\n, $bytes bytes\nor\n , sprintf('%.1f', $bytes/1024**2), MiB\n; C:\hometest.pl The acc. size of the files in my Perl installation is: 90529266 bytes or 86.3 MiB C:\home -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: Printing directory sizes

2009-03-05 Thread Gunnar Hjalmarsson
Gunnar Hjalmarsson wrote: Dermot wrote: snip This will only give you the top level of directories: 07/02/2009 14:00DIR . 07/02/2009 14:00DIR .. 07/02/2009 14:00DIR bin 15/03/2006 22:14DIR eg 07/02/2009 14:00DIR html 15/03

Re: user sessions

2009-03-04 Thread Gunnar Hjalmarsson
? http://search.cpan.org/search?query=session -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org For additional commands, e-mail: beginners-cgi-h...@perl.org http://learn.perl.org/

Re: finding modules via @INC

2009-03-04 Thread Gunnar Hjalmarsson
sys...@wowway.com wrote: I'm trying to use an XML pretty printer called xmlpretty ... http://groups.google.com/group/comp.lang.perl.misc/browse_thread/thread/5407c504591e0c4e Do not multi-post!! http://lipas.uwasa.fi/~ts/http/crospost.html -- Gunnar Hjalmarsson Email: http://www.gunnar.cc

Re: How to set env variable

2009-03-04 Thread Gunnar Hjalmarsson
ramesh.marimu...@wipro.com wrote: How to set env variable? I'm using PERL in WINDOWS. My question phrasing may be wrong. Actually my question is I need to run Perl from anywhere from my system. s/env variable/PATH/ Type help path -- Gunnar Hjalmarsson Email: http://www.gunnar.cc

Re: finding modules via @INC

2009-03-04 Thread Gunnar Hjalmarsson
Jerald Sheets wrote: In your code you can specify the directory location of the pm: use lib '/path/to/pm'; That makes no sense. It would cause Perl to look for /path/to/pm/XML/Handler/YAWriter.pm and the module would not be found. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi

Re: finding modules via @INC

2009-03-04 Thread Gunnar Hjalmarsson
Jerald Sheets wrote: Gunnar Hjalmarsson wrote: Jerald Sheets wrote: In your code you can specify the directory location of the pm: use lib '/path/to/pm'; That makes no sense. It would cause Perl to look for /path/to/pm/XML/Handler/YAWriter.pm and the module would not be found. Note

MIME encoding and Mail::Sender (was: Sending email ...)

2009-03-04 Thread Gunnar Hjalmarsson
=~ /(.{1,40}.*?(?:\s|$))/g ) { my $part = $1; push @parts, MIME::QuotedPrint::encode($part, ''); } join \r\n\t, map { =?$enc?Q?$_?= } @parts; } The resulting output is: =?UTF-8?Q?Sm=C3=B6rg=C3=A5sbord?= -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi

Re: I need scoping help

2009-03-04 Thread Gunnar Hjalmarsson
right curly to end the while loop. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: connecting to multiple hosts using Net::SSH2

2009-03-04 Thread Gunnar Hjalmarsson
::SSH2, and warn() and next() are not run. The standard solution to this problem is eval(): eval { $ssh2-connect($_) }; if ($@) { warn Unable to connect host $_: $@ and next; } -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail

Re: Accepting default value for user input

2009-03-02 Thread Gunnar Hjalmarsson
if lc $normal eq 'yes' or lc $normal eq 'no'; http://perldoc.perl.org/functions/grep.html -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: 2 files, 1 package, shared constants

2009-03-01 Thread Gunnar Hjalmarsson
; use constant { MY_FIRST_CONSTANT = 'hello world!' }; use Exporter; our @EXPORT = qw/MY_FIRST_CONSTANT $MY_SECOND_CONSTANT routine1 /; #...@export_ok would be better In this case there is only one package. Would you still bother with Exporter? Why? -- Gunnar

Re: Stopping variable interpolation/evaluation

2009-03-01 Thread Gunnar Hjalmarsson
(). -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Use join on multi-dimensional array

2009-02-27 Thread Gunnar Hjalmarsson
$line = join ',', @{ $record[0] }; -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Acepting default value for user input

2009-02-27 Thread Gunnar Hjalmarsson
. Do you want to do the normal thing? [yes] : print 'Do you want to do the normal thing? [yes] : '; chomp( my $normal = STDIN ); $normal ||= 'yes'; -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org

Re: Acepting default value for user input

2009-02-27 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Fri, Feb 27, 2009 at 11:07, Gunnar Hjalmarsson nore...@gunnar.cc wrote: Sarsamkar, Paryushan wrote: I would like to accept some user inputs (using STDIN), but it might be easier for a user if I can provide the default value, so that they just have to press ENTER. How can

Re: Retrieving Cookies does not return all domain values

2009-02-26 Thread Gunnar Hjalmarsson
, $value; push @cookie_values, $value if $name eq 'var'; } -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org For additional commands, e-mail: beginners-cgi-h...@perl.org http://learn.perl.org/

  1   2   3   4   5   6   7   8   9   10   >