Re: script to match a valid email id

2014-07-11 Thread Gunnar Hjalmarsson
y 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...@p

Re: usage of Split

2010-07-28 Thread Gunnar Hjalmarsson
the given string. Can you clarify what 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
P headers 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

Re: Best way to mix two lists

2009-07-10 Thread Gunnar Hjalmarsson
rlish) way 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...@

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

2009-07-03 Thread Gunnar Hjalmarsson
ist of such records, one on each line, and with identical markup? If not, trying to do it with one substitution is a crazy 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: 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 a

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

Re: question about constants

2009-06-23 Thread Gunnar Hjalmarsson
p work as expected, 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

Re: word substitute with character count.

2009-06-18 Thread Gunnar Hjalmarsson
th $newword < 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 additio

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/

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

2009-06-04 Thread Gunnar Hjalmarsson
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...@perl.org

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 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 &quo

Re: interaction with a module and http tags

2009-05-25 Thread Gunnar Hjalmarsson
here 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

Re: interaction with a module and http tags

2009-05-25 Thread Gunnar Hjalmarsson
al 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: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Difference between for & foreach loop

2009-05-25 Thread Gunnar Hjalmarsson
loops, but a true for loop is something else. 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

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 lin

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

2009-05-19 Thread Gunnar Hjalmarsson
ible. 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/co

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: File::Find

2009-05-18 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Mon, May 18, 2009 at 19:05, Gunnar Hjalmarsson 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 at File::Finder

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: Help with LWP

2009-05-13 Thread Gunnar Hjalmarsson
with cookies, and it's possible that the script requires one or more cookie to be sent as part of the request. Those are two obvious things, but there might be more into it. Why not simply ask 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: Array Initialization

2009-05-13 Thread Gunnar Hjalmarsson
s 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.gunna

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: 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

Re: Array Initialization

2009-05-12 Thread Gunnar Hjalmarsson
print "\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: LWP Select Options Count

2009-05-12 Thread Gunnar Hjalmarsson
print "There are $count options.\n"; Please study the above and compare it with your attempt 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 combina

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.

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/cg

Re: Reporting bugs

2009-05-01 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Fri, May 1, 2009 at 10:18, Gunnar Hjalmarsson 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. Unfortunately the

Re: Reporting bugs

2009-05-01 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Wed, Apr 29, 2009 at 19:07, Chas. Owens wrote: On Wed, Apr 29, 2009 at 18:44, Gunnar Hjalmarsson 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 not quite get the distinction. Are the

Re: Reporting bugs

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

Reporting bugs (was: package variables)

2009-04-29 Thread Gunnar Hjalmarsson
Chas. Owens wrote: 2009/4/28 Gunnar Hjalmarsson : snip I believe the standard response is "patches are welcome." 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: ht

Re: package variables

2009-04-29 Thread Gunnar Hjalmarsson
nt that it's more into it than just adding the package name. (Such a hint would have been 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.

Re: package variables

2009-04-28 Thread Gunnar Hjalmarsson
Jenda Krynicky wrote: From: "Chas. Owens" On Tue, Apr 28, 2009 at 13:38, Gunnar Hjalmarsson 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. They had turned on stri

Re: package variables

2009-04-28 Thread Gunnar Hjalmarsson
t what 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

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

2009-04-25 Thread Gunnar Hjalmarsson
including use of scripts or web crawlers) and shall ensure that you comply with the instructions set out in any robots.txt file present 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
Chas. Owens wrote: On Wed, Apr 22, 2009 at 15:25, Gunnar Hjalmarsson 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 encode

Re: \w regular expressions unicode

2009-04-22 Thread Gunnar Hjalmarsson
"FALSE" here, but uncomment "use utf8" and it gets "TRUE". 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

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 n

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 t

Re: libwww-perl library

2009-04-22 Thread Gunnar Hjalmarsson
whatever the path is to your 5.6 library) Could the folks who 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 Hjalm

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 o

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

2009-04-19 Thread Gunnar Hjalmarsson
Adwords::CampaignService POD say 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: 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-uns

Re: \w regular expressions unicode

2009-04-18 Thread Gunnar Hjalmarsson
smörgåsbord"; $s = decode "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
that I can use in package Amy e.g. Util::foo() or Util->foo() but then I cannot get 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-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: 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: 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 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 make that change you

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: escaping regex to do math on backreferences

2009-04-12 Thread Gunnar Hjalmarsson
earth would you want 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-ma

Re: CPAN not working for me

2009-04-11 Thread Gunnar Hjalmarsson
if that's the reason why 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-mai

Re: LWP

2009-04-08 Thread Gunnar Hjalmarsson
: 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. --

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 Hja

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

2009-04-02 Thread Gunnar Hjalmarsson
perldoc.perl.org/perlsub.html 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.) --

Re: Can't Retrieve Data From foreach block

2009-03-30 Thread Gunnar Hjalmarsson
; open 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:

Re: bot trouble

2009-03-28 Thread Gunnar Hjalmarsson
2 3', }; and you are using 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 --

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
$ John pointed out one mistake. 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/cg

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 E

Re: Editing file

2009-03-21 Thread Gunnar Hjalmarsson
Randal L. Schwartz wrote: "Gunnar" == Gunnar Hjalmarsson 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, '+<', $

Re: Editing file

2009-03-20 Thread Gunnar Hjalmarsson
--/; push @keep, $_; } seek $fh, 0, 0; 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

Re: remove the last paragraph tag and its contents

2009-03-17 Thread Gunnar Hjalmarsson
ent inside the 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,(.+),$1,is -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...

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/

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 ma

Re: Making Web Form Data Safe

2009-03-16 Thread Gunnar Hjalmarsson
re parameter is intended 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: What's up with NNTP?

2009-03-14 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Sat, Mar 14, 2009 at 17:49, Gunnar Hjalmarsson 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 If it does try typin

Re: What's up with NNTP?

2009-03-14 Thread Gunnar Hjalmarsson
Randal L. Schwartz wrote: "Gunnar" == Gunnar Hjalmarsson 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 servi

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 -- To

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: I"m 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

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

2009-03-12 Thread Gunnar Hjalmarsson
ing to accomplish 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: beg

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

2009-03-11 Thread Gunnar Hjalmarsson
t the *reason(s)* 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
he /g modifier? Since I am 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 unsubscri

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

2009-03-09 Thread Gunnar Hjalmarsson
7, 33, 29, 25, 21, 2,], }, core2 => { loopback => [254,], link_int => ['int1', 'int2', 'int3',], link_ip => [34, 54, 10, ], }, core3 => { loopback => [252,], link_int => ['int1',

Warnings

2009-03-09 Thread Gunnar Hjalmarsson
lized value $x in print at C:\home\test.pl line 7. C:\home> Unless "no warnings" had been effective, line 5 would also have generated a warning. -- 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-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

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"

Re: Printing directory sizes

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

Re: Printing directory sizes

2009-03-05 Thread Gunnar Hjalmarsson
my Perl installation is:\n", " $bytes bytes\nor\n ", sprintf('%.1f', $bytes/1024**2), " MiB\n"; C:\home>test.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

Re: hashes + use constant - weird behavior

2009-03-05 Thread Gunnar Hjalmarsson
alue is: value 1/value 2 Comparison 1: 1 Comparison 2: 1 ??? So, what behavior exactly is it that you consider weird? What 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
? 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: connecting to multiple hosts using Net::SSH2

2009-03-04 Thread Gunnar Hjalmarsson
rror happens inside Net::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/c

Re: I need scoping help

2009-03-04 Thread Gunnar Hjalmarsson
]*$thehl*$thepare...@array[3]*@array[4]"; $theHL = $theHL + 1; } } $line =~ s/$/~/; if ($line ne "~\n") { print TOFILE $line; } Missing 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/

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

2009-03-04 Thread Gunnar Hjalmarsson
/[[:^ascii:]]/; my @parts; while ( $str =~ /(.{1,40}.*?(?:\s|$))/g ) { my $part = $1; push @parts, MIME::QuotedPrint::encode($part, ''); } join "\r\n\t", map { "=?$enc?Q?$_?=" } @parts; } The resulting

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 fou

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.gun

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.gunn

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.gunn

Re: Accepting default value for user input

2009-03-02 Thread Gunnar Hjalmarsson
x27;s another way to say: last 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: Stopping variable interpolation/evaluation

2009-03-01 Thread Gunnar Hjalmarsson
-^^^^^^ Use print(), not printf(). -- 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
ngs; use strict; 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

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 wrote: Sarsamkar, Paryushan wrote: I would like to accept some user inputs (using ), 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 I do that? I&#x

Re: Acepting default value for user input

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

Re: Use join on multi-dimensional array

2009-02-27 Thread Gunnar Hjalmarsson
use 'join' to create a CSV output line? Yes. my $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: picking largest key by value..

2009-02-26 Thread Gunnar Hjalmarsson
"5"}}; Any special reason why you say my %files = %{{ ... }}; instead of simply my %files = ( ... ); ? While this suggestion is inefficient, it takes less typing compared to other postings: my $max = ( sort { $files{$b} <=> $files{$a} } keys %files )[0]; -- Gunnar

Re: network program for copying file from a remote machine

2009-02-26 Thread Gunnar Hjalmarsson
about using CPAN module Net::SCP - http://search.cpan.org/~ivan/Net-SCP-0.08/SCP.pm I am not able to use any module . That sounds like an unusual form of disability. Why do you want to use Perl then? -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/cont

Type and Size of the uploaded file

2009-02-26 Thread Gunnar Hjalmarsson
"\tMIME type: $info->{$file}{mimetype}\n", "\tSize: $info->{$file}{bytes}\n\n"; } Please see http://search.cpan.org/perldoc?CGI::UploadEasy for further guidance. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail:

Re: Sending email w/Mail::Builder::Simple -- need help

2009-02-25 Thread Gunnar Hjalmarsson
msg => $msg, } ) ) ) { print "Message was sent.\n"; last; } else { warn "Send attempt $try. $sender->{'error_msg'}\n"; $try == 4 ? die 'I give up' : sleep 10; } } -- 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: Sending email w/Mail::Builder::Simple -- need help

2009-02-25 Thread Gunnar Hjalmarsson
Octavian Râs,nit,a( wrote: From: "Gunnar Hjalmarsson" This is an example program where "use utf8;" makes a difference: use utf8; $igÃ¥r = '2009-02-24'; print "Yesterday: $igÃ¥r\n"; ("igÃ¥r" is Swedish for "yesterday"

Re: Sending email w/Mail::Builder::Simple -- need help

2009-02-25 Thread Gunnar Hjalmarsson
[ new attempt - encoding is tricky... ] Gunnar Hjalmarsson wrote: Octavian Râsnita wrote: If I used it in a UTF-8 encoded perl program and was also using "use utf8;" in it, I expected that it understand that it should be encoded to UTF-8. I don't think that's what the

  1   2   3   4   5   6   7   8   9   10   >