Re: A multi line pattern match question

2016-07-14 Thread Charles DeRykus
One easier approach: use Tie::File; tie( my @array, 'Tie::File', "/path/to/file" ) or die $!; my $n = 0; while ( $n <= $#array ) { if ( $array[$n] =~ /.*[Oo]rder deny,allow(.*)/ and $n < $#array and $array[$n+1] =~ /[\Dd]eny from all(.*)/ ) { $n

Re: unexpected escaping

2016-01-29 Thread Charles DeRykus
On Fri, Jan 29, 2016 at 12:39 AM, Jorge Almeida wrote: > Can someone help me to understand this? > > #!/usr/bin/perl > use strict; > use warnings; > my $s='\\n'; > print $s; > > > Output: > \n > > Expected output: > \\n > > > Jorge Almeida > From: perldoc perlop q/STRING/ 'STRING'

Re: access hash in specific sequence

2015-09-03 Thread Charles DeRykus
reach statement to access them in the correct sequence? > If the 'seq' items just maintain insertion order, then: use Tie::IxHash; use feature 'say'; tie( my %pagetypes, 'Tie::IxHash') or die $!; %pagetypes=( 'Delivery Note' => ..., Foo=>, Bar=>); foreach my $pagetype (keys %pagetypes) { ... } say $pagetypes{'Delivery Note'}{weight}; -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Display a hash in the order of an array

2015-07-20 Thread Charles DeRykus
$entry (@{$ordered{$key}}) { > print $entry . "\n"; > } > ++$i; > } > Depending on output preference and level of detail, one possibility: ... for foreach my $entry ( @{$ordered{$ip}} ) { while ( my($date, $data) = each %{$entry} ) {

Re: Display a hash in the order of an array

2015-07-17 Thread Charles DeRykus
y,$value}; } say Dumper \%ordered; Leaving exact details of printing as an exercise for reader... -- Charles DeRykus On Fri, Jul 17, 2015 at 6:11 AM, Vincent Lequertier wrote: > Hi, > > I have the following structure : > > $hash{$date} = { > 'ip'

Re: Debugging and passing constant value at run time

2015-07-07 Thread Charles DeRykus
an argument to the script to save editing: #!perl my $DEBUG; ($DEBUG = shift) //= 0; # no debug if no arg missing ... if ($DEBUG) { ... } -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: catching utf8 errors

2015-03-14 Thread Charles DeRykus
occurs. How > do I notice it programmatically? > > open my $fh, '<:encoding ) or die ... { open( local *STDERR,'>',\my $err); my $string = <$fh>; if ($err =~ /does not map to Unicode/) { # take action. } } -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: An issue of Scope that I do not understand

2015-02-28 Thread Charles DeRykus
... } But with everything in lexical scope, you could just pass any needed arg's directly and eliminate the closure altogether. -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: An issue of Scope that I do not understand

2015-02-27 Thread Charles DeRykus
print $ref->[$iter++]; }; my $report_dynamic = sub( my $ref = shift; print $ref->[$iter++]; ... #MAIN_CODE START foreach $task (@tasks) {

Re: Debug when script WILL NOT RUN

2015-02-01 Thread Charles DeRykus
nest of errors to tease out the culprit: For instance, you'd run: perltidy badlywrittenscript.pl and might get an error diagnostic file that'd say something like: The most recent un-matched '{' is on line 7 7: for my $i (@xxx) { ^ 12: To save a full .LOG file rerun with -g --- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: should this old forumulation still work?

2015-01-20 Thread Charles DeRykus
On Tue, Jan 20, 2015 at 9:12 PM, Uri Guttman wrote: > On 01/20/2015 11:28 PM, Charles DeRykus wrote: >>> >>> ... >>> or something odd >>>my $contents = do { local $/; map { chomp } }; >>> >> I'm afraid this, while appeali

Re: should this old forumulation still work?

2015-01-20 Thread Charles DeRykus
ero, one, or more elements in the returned value. Remember, map has tossed all but the final value at this point so it just returns 1. Clear as mud? -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional comm

Re: Looping regexes against a list

2015-01-20 Thread Charles DeRykus
ts. You might want to demo the list of regexes for the shooting gallery :) -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Parsing multi column files

2015-01-18 Thread Charles DeRykus
int(rand( $#lines ) ) ]; # perldoc -f rand my @words = split(" ",$line) ; say $words[0]; Then, if you're counting calories and want a one-liner: perl -E 'open(F,"rationale.txt");@l=; say +( split(" ", $l[int(rand($#l))]) )[0]' -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Using regular expressions to populate a variable?

2015-01-18 Thread Charles DeRykus
h->text =~ m/Insulter\ (.*)\ Taken/ ); > ... For more info: see perldoc perldata. There a full discussion of list vs scalar context . -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: How does opendir/readdir process files

2015-01-13 Thread Charles DeRykus
> ... > I think the normal and original behavior is no reference. I think > they added the reference in 5.14 too. Perhaps the documentation > just fails to mention that support for arrays was added in 5.14 > along with references? Hopefully I got that right this time. :) > Ah, RTFM would've helped

Re: How does opendir/readdir process files

2015-01-09 Thread Charles DeRykus
On Fri, Jan 9, 2015 at 10:31 AM, Brandon McCaig wrote: > Charles: > > On Fri, Jan 9, 2015 at 12:46 PM, Charles DeRykus wrote: >> On Fri, Jan 9, 2015 at 3:39 AM, Dermot wrote: >>> I think John has answered your immediate question. >>> >>> ... >&g

Re: How does opendir/readdir process files

2015-01-09 Thread Charles DeRykus
On Fri, Jan 9, 2015 at 3:39 AM, Dermot wrote: > I think John has answered your immediate question. > > ... > for (0..$#files) { > print "$_) $files[$_]\n"; > } > Alternatively (at least since 5.14) : say "$k) $v" while ($k,$v) = each @files; -- Ch

Re: Get return value when running cmd like this

2015-01-05 Thread Charles DeRykus
's no output, the shell process itself may be hanging for some reason. IPC::Open3 or the more versatile IPC::Run might provide some info about what was going on prior to the hang if the info isn't buffered: use IPC::Run qw/run/; my @cmd =("rsnapshot"); run( \@cmd, \undef, \$out, \$err) or die "run: $!"; say "out:$out \nerr:$err"' -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Match HTML ...... string over multiple

2014-11-18 Thread Charles DeRykus
r instance and you're the generator), you could do something along this line: my $regex = qr{ .*? .*? ( ).*? }six; { local($/); my $content = ; # substitute your lexical filehandle while ( $content =~ /$regex/g) {

Re: masks earlier declaration in same scope

2014-10-13 Thread Charles DeRykus
} ) ) { } But that's really bizarre too. Did you really intend to declare and populate an array and throw in a conditional all in a one-liner? Do you know for instance that my @foo = $some_scalar is the equivalent of just saying: my @foo = ($some_scalar). So, just a few thoughts... some more explanation of what that code is intended to do would help. -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: return the list content

2014-09-12 Thread Charles DeRykus
rrected on subsequent calls. Scope is preserved without doing extra work on re-entry. Note the IIRC. Corrections welcome. -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Embed perl interpreter and call C function from perl?

2014-08-20 Thread Charles DeRykus
; only allows C to be used to write plugins. Those plugins are small ".so" > files that have to use some header files which define the API. I somehow > want to export the plugin API "into the Perl world" to make it possible to > write plugins in Perl. > You might

Re: one line script for word count

2014-06-30 Thread Charles DeRykus
On Mon, Jun 30, 2014 at 1:53 PM, Charles DeRykus wrote: > On Mon, Jun 30, 2014 at 1:41 PM, Charles DeRykus wrote: >> On Mon, Jun 30, 2014 at 11:57 AM, Sunita Pradhan >> wrote: >>> >> >> You could alter context, ie, change "if" to "wh

Re: one line script for word count

2014-06-30 Thread Charles DeRykus
On Mon, Jun 30, 2014 at 1:41 PM, Charles DeRykus wrote: > On Mon, Jun 30, 2014 at 11:57 AM, Sunita Pradhan > wrote: >> Hi >> >> I want to count number of occurrences of one word in a line within one >> single line of perl script . >> >> My code : >

Re: one line script for word count

2014-06-30 Thread Charles DeRykus
e 1; otherwise 0. See the docs for a discussion of context, eg, perldoc perldata. You could alter context, ie, change "if" to "while", to get the correct count: $c++ while $line =~ /\s\w+\s/g; -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Need to Grep only fail count from the Pattern.

2014-06-24 Thread Charles DeRykus
1:30 PM, Uday Vernekar > wrote: >> >> Thanks everybody will work out the Feasible option from all >> these..Thanks a lot >> >> >> >> On Mon, Jun 23, 2014 at 10:12 PM, Charles DeRykus >> wrote: >>> >>> On Mon, Jun 23, 2014

Re: Need to Grep only fail count from the Pattern.

2014-06-23 Thread Charles DeRykus
int > > if 0--Sucess > if >0--Fail > Another way: while ( ) { ... my $fail_count - ( split( /\|/, $_ ) )[-2]; ... } See: perldoc -f split -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: File checks

2014-05-22 Thread Charles DeRykus
me ) { > say "$fname is a plain file"; > } > Is there a simpler way to do this? > Potentially shorter and arguably simpler if you use the special underscore argument to access file info for previous test, eg, if ( -f $fname and not -l _ ) { say...

Re: Fail to match mixed quote pattern

2014-03-14 Thread Charles DeRykus
anyone help me with this ? > Here's a safer, more efficient version: see: perldoc perlre * uses 'qr' for reg.exp. compilation * avoid speed penalty of $& with /p switch * \g{} captures instead of \1 which can be ambiguous in case of \10 eg. my $pattern = qr/("|&#x

Re: regex and parse

2014-03-11 Thread Charles DeRykus
l reg exp tutorial) perlre (Perl regular expressions, the rest of the story) .-- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Fwd: perl regexp performance - architecture?

2014-02-17 Thread Charles DeRykus
On Mon, Feb 17, 2014 at 4:25 PM, Phil Smith wrote: > On Mon, Feb 17, 2014 at 6:16 PM, Charles DeRykus wrote: > >> >> On Mon, Feb 17, 2014 at 12:41 PM, Phil Smith wrote: >> >>> I'm currently loading some new servers with CentOS6 on which perl5.10 is >

Re: perl regexp performance - architecture?

2014-02-17 Thread Charles DeRykus
ons for improvements. I'm > happy to provide further relevant details. > This sounds like it could be something OS-specific and, googling "CentOS regex performance" generates hits, eg, > > http://pkgs.org/centos-5/puias-computational-x86_64/boost141-regex-1.4.0-2.el5.x86_64.rpm.html > HTH, Charles DeRykus

Re: OO perl programming

2014-02-05 Thread Charles DeRykus
d, then go on to other suggested sources... or not :) TIMTOWDI -- Charles DeRykus

Re: mv Is Not Working the Same Way Under System as Under a Shell.

2014-01-30 Thread Charles DeRykus
later. > > The script, when run, is owned by root and run by root > Another recommendation: File::Copy is core now I believe, is portable, faster, easier and more transparent than deciphering shell error returns, and enables you to avoid the nasty quoting issues of a 'system' call: use File::Copy; move( $file1, $file2) or die "move: $!"; See: perldoc File::Copy -- Charles DeRykus

Re: perlre(1) and substitution evaluations

2013-11-30 Thread Charles DeRykus
On 11/30/2013 5:16 AM, Lars Noodén wrote: On 11/30/2013 02:55 PM, Charles DeRykus wrote: [ .. Thanks. I see those in perlop and perlfunc. In perlfunc, it is grouped as "Regular expressions and pattern matching" though that man page just points to perlop. A really clear description

Re: perlre(1) and substitution evaluations

2013-11-30 Thread Charles DeRykus
7;s the cross ref. in perlre: For reference on how regular expressions are used in matchings of "m//", operations, plus various examples of the same, see discussions of "m//", "s///", "qr//" and "??" in "Regexp Quote-Like Operators" in perlop.ls of Modifiers quoted constructs" in perlop -- Charles DeRykus -- Charles DeRykus

Re: Need help with a programming problem

2013-10-02 Thread Charles DeRykus
On Wed, Oct 2, 2013 at 5:10 PM, Peter Holsberg wrote: > Charles DeRykus has written on 10/2/2013 5:49 PM: > > > > Wouldn't a manual edit be easier... or is this a recurrent problem? > > If recurrent, a messy solution may be possible but fragile unless > > the htm

Re: How Much is Too Much? (WAS: formatting a list)

2013-10-02 Thread Charles DeRykus
On Wed, Oct 2, 2013 at 1:58 AM, James Griffin wrote: > * Shawn H Corey [2013-10-01 17:34:06 -0400]: > > > On Tue, 1 Oct 2013 14:14:16 -0700 > > Charles DeRykus wrote: > > > > > I'm not bucking for "net nanny" but, while full solutions and &g

Re: formatting a list

2013-10-01 Thread Charles DeRykus
t to embarrass anyone but there was no mention of DIY attempts, no soliciting of hints or approaches, or even mention of being stuck or frustrated thinking about how to start. A "guru service while you wait " may be excellent but disciples will fail to ever get their G.E.D. (guru equivalency diploma). -- Charles DeRykus

Re: Sleep

2013-09-16 Thread Charles DeRykus
> On Sun, Sep 15, 2013 at 6:59 PM, Charles DeRykus > wrote: left: ", $start+$sleep -time() }; > ... Actually, this is wrong because if sleep(3) is interrupted by any signal it will return, so something like this should work, eg my $secs_to_sleep = 60; my $start = time(); my

Re: parsing html

2013-08-08 Thread Charles DeRykus
her parsing modules are, you certainly would be grinding out more code. -- Charles DeRykus

Re: Convert any date format to ISO

2013-07-27 Thread Charles DeRykus
On Fri, Jul 26, 2013 at 4:45 AM, Perl Beginners wrote: > On 07/25/2013 04:40 PM, Charles DeRykus wrote: > >> >> >> >> On Wed, Jul 24, 2013 at 10:56 PM, Michael Brader < >> mbra...@internode.com.au >> <mailto:mbra...@internode.com.**au>>

Re: Convert any date format to ISO

2013-07-25 Thread Charles DeRykus
st accept a hash ref of non-standard format specs. Then, you could just output with UnixDate as usual. eg, ParseDate( ... , { fmt1="%d-%m-%Y", fmt2=... } ); -- Charles DeRykus

Re: url_encode for LWP POST

2013-07-25 Thread Charles DeRykus
ng: $req->as_string; Probably the easiest way to do this is with HTTP::Request::Common which will handle escaping the form parameters for you, eg, use HTTP::Request::Common; use LWP::UserAgent; $ua->request( POST 'http://rt.cpan.org/Public/Dist/Display.html

Re: last

2013-06-28 Thread Charles DeRykus
On Fri, Jun 28, 2013 at 1:21 AM, Dr.Ruud wrote: > On 28/06/2013 09:08, Charles DeRykus wrote: > > [...] I was making a case that "do" in limited cases could be a >> >> shorter and/or slightly clearer idiom. >> > > I think the context was if you would

Re: last

2013-06-28 Thread Charles DeRykus
{$in =<>; ... } until $in =~ /q/' > > > > vs. > > > > perl -e 'while ( $in = <>; ... ) { ... last if $in =~ /q/}' > > > I find a combination of the two is most useful for quickly generating > reports: [...snip] > ... > Hm, this wasn't an argument for exclusive "either/or" usage at all. Rather I was making a case that "do" in limited cases could be a shorter and/or slightly clearer idiom. -- Charles DeRykus

Re: last

2013-06-27 Thread Charles DeRykus
when 'do' isn't always a don't :) 'do' might be a shorter, more readable idiom in the sense of "do something until a condition occurs": perl -e 'do {$in =<>; ... } until $in =~ /q/' vs. perl -e 'while ( $in = <>; ... ) { ... last if $in =~ /q/}' -- Charles DeRykus

Re: Handling special characters in peoples names in XML

2013-06-25 Thread Charles DeRykus
y be useful: > use Encode::Guess; my $decoder=Encode::Guess->guess("Grégoire"); die $decoder unless $decoder; print $decoder->name;#---> utf8 -- Charles DeRykus

Re: Perl error codes and warnings

2013-05-28 Thread Charles DeRykus
s are fairly intuitive but you can add: use diagnostics qw/-verbose/; for added explanations. -- Charles DeRykus

Re: Can't close filehandle

2013-05-01 Thread Charles DeRykus
On Wed, May 1, 2013 at 12:57 PM, Manfred Lotz wrote: > On Wed, 1 May 2013 12:00:18 -0700 > Charles DeRykus wrote: > > > > ... > > > Thanks for your detailed explanations. I think that close should > > > work as I cannot see any reason why a failure of a comma

Re: Can't close filehandle

2013-05-01 Thread Charles DeRykus
h more obscure: made it past ok... Can't close(GLOB(0x64dcf8)) filehandle: '' at... -- Charles DeRykus

Re: Can we use string as variable name

2013-04-30 Thread Charles DeRykus
> On Tue, Apr 30, 2013 at 10:07 AM, Piyush Verma <114piy...@gmail.com> > wrote: > Hi,I want to use string as a variable name, please explain if there is any way > in perl. > ... This is a FAQ. See: http://perldoc.perl.org/perlfaq7.html#How-can-I-use-a-variable-as-a-variabl

Re: Any alternative for substr() function

2013-04-12 Thread Charles DeRykus
"Devel::NYTProf", I need to check if my SA if he will allow me to > install You can usually just install the module under your own directory... See: perldoc -q "How do I keep my own module/library directory?" -- Charles DeRykus

Re: no warnings inside a loop

2013-04-03 Thread Charles DeRykus
doc: ... use warnings; my @a; { no warnings; my $b = @a[0]; } my $c = @a[0]; The code in the enclosing block has warnings enabled, but the inner block has them disabled. ... -- Charles DeRykus

Re: IPC::Open3 Usage

2013-03-21 Thread Charles DeRykus
On Thu, Mar 21, 2013 at 6:41 PM, Charles DeRykus wrote: > On Thu, Mar 21, 2013 at 3:12 PM, Dominik Danter wrote: >> Hi I just don't understand the perlfaq example. All I want is to capture >> output >> of an external command's stdout and stderr. Here is what I&

Re: Mechanize: first attempt at scraping (should be something trivial)

2013-03-13 Thread Charles DeRykus
roblem is that Mech by default throws fatal errors so if it couldn't fetch content, your program dies before "mech ran" occurs. Only if you said $agent->new(autocheck=>0), would you see it. You can see the differing output in these: $agent->new(autocheck=>0); # toggle 0/1 $

Re: Mechanize: first attempt at scraping (should be something trivial)

2013-03-13 Thread Charles DeRykus
to check for errors in case of site outage for instance. However this worked for me a few moments ago when I tried: $agent->get(...); die $agent->status unless $agent->success; "; print "content: $a->content"; -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Return values more than 256?

2013-03-08 Thread Charles DeRykus
id altogether since there's an implicit waitpid when the pipe gets closed. It gets a bit confusing but the pipe close needs to be checked first and then subsequently the child return as another poster demonstrated: close $trexe or warn $! ? "Error closing $tr pipe: $!"

Re: Non interactive interaction

2013-02-28 Thread Charles DeRykus
odules and whatnot so I can move on with my life. > This is for a personal Linux (Ubuntu)machine > so yes I'm root & I want to do this on a system wide basis. > I haven't used it but App::cpanminus may be a help: http://search.cpan.org/~miyagawa/App-cpanminus-1.6002/

Re: other ways to parse emails from html?

2013-01-31 Thread Charles DeRykus
ome_url ); my @emails; foreach my $link ( $t->look_down(_tag=>'a', href=>qr/^\s*mailto/) ) { my $url = URI->new( $link->attr('href') ); push( @emails, $url->path ); } > > > But if you want to get any e-mail from a page, no matter if it appear

Re: trying to understand HTML::TreeBuilder::XPath

2013-01-28 Thread Charles DeRykus
ma separated emails. See: perldoc URI. my $uri = URI->new($link); if ( $uri->scheme eq 'mailto') { my $email = $uri->path; ... } -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: character setts in a regexp

2013-01-14 Thread Charles DeRykus
On Sat, Jan 12, 2013 at 12:56 PM, Charles DeRykus wrote: > On Fri, Jan 11, 2013 at 2:01 PM, Christer Palm wrote: >> Hi! >> >> I have a perl script that parses RSS streams from different news sources and >> experience problems with national characters in a regexp funct

Re: Line-oriented socket I/O using select()

2013-01-13 Thread Charles DeRykus
reinventing the wheel, one bug at a time :-). > What does the experienced Perl programmer - or socket-level programmer in > general - do in this situation? > I'm not experienced in heavy duty socket-level programming but you may want to invest in learning POE: https://poe.pe

Re: character setts in a regexp

2013-01-12 Thread Charles DeRykus
quot;:utf8"); $cosa = "my \x{263a}"; print "cosa=$cosa\n"; print "found smiley at \\b\n" if $cosa =~ /\b\x{263a}/; print "found smiley (no \\b)" if $cosa =~ /\x{263a}/; The output: cosa=my ☺ found smiley (no \b) -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: substitution: interpolate capture buffer into variable?

2012-12-26 Thread Charles DeRykus
itution It may be a good sanity check to do so though if you're always expecting the substitution to succeed. Otherwise, even though the eval works, a failed pattern match will fail silently. But you could still report failure by checking the substitution return: s/.../../ or carp "pattern failed"; -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Help with a regex

2012-12-21 Thread Charles DeRykus
supp...@dnsbed.com That's closer to what you want... one solution to the unwanted \ would be $user =~ tr/\\//d; -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Retry function?

2012-12-13 Thread Charles DeRykus
On Thu, Dec 13, 2012 at 8:09 AM, Alvin Ramos wrote: > Any one have any suggestions of a module/function/method to write a perl > script to try pinging a server then after the 3rd time to send an email? > Thanks in advance... perldoc Net::Ping -- Charles DeRykus -- To unsubscrib

Re: How to display UTF-8 output to command shell in Win7?

2012-12-01 Thread Charles DeRykus
On Sat, Dec 1, 2012 at 10:06 PM, boB Stepp wrote: > On Sat, Dec 1, 2012 at 11:58 PM, Charles DeRykus wrote: >> On Sat, Dec 1, 2012 at 8:50 PM, boB Stepp wrote: >>> >>> What I would like to do is make chcp 65001 the default behavior of the >>> command consol

Re: How to display UTF-8 output to command shell in Win7?

2012-12-01 Thread Charles DeRykus
On Sat, Dec 1, 2012 at 9:58 PM, Charles DeRykus wrote: > ... > > On the command line, I believe you just redirecto to nul: > > chch 2>nul ^^^ chcp -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubs

Re: How to display UTF-8 output to command shell in Win7?

2012-12-01 Thread Charles DeRykus
erent to do, there is > no way to permanently change the default behavior of the command > prompt on my system. Is it clear what I am actually asking? > > One thing you add above, "use strict;": I have not reached this in my > book yet. Is this something you would recommend me to add to my > scripts routinely? > Yes, 'use strict;' has been a best practice for some time. See: perldoc perlstyle -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: How to display UTF-8 output to command shell in Win7?

2012-11-29 Thread Charles DeRykus
On Thu, Nov 29, 2012 at 5:00 AM, timothy adigun <2teezp...@gmail.com> wrote: > Hi, > Please check my comments below: > > On Thu, Nov 29, 2012 at 8:55 AM, Charles DeRykus wrote: >> >> On Wed, Nov 28, 2012 at 8:10 PM, boB Stepp wrote: >> > As I have mentioned

Re: How to display UTF-8 output to command shell in Win7?

2012-11-28 Thread Charles DeRykus
I would rather I did not get the first two lines of output. > Is there a way to accomplish this and still have warnings turned on? > (I understand that the first line is a consequence of my system > command to turn on UTF-8.) > > binmode STDOUT, ":utf8"; -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: hash help !

2012-11-15 Thread Charles DeRykus
=> 10.00.00.00.aa.5a.9b.63 > > How do i build all the entries into hash including the duplicates on both > sides keys and values. One possible way: DB_File has a BTREE file type (with the R_DUP setting and the 'seq' API method) that enables storing/retrieving dup's. There&#x

Re: hash help !

2012-11-14 Thread Charles DeRykus
=> 10.00.00.00.aa.5a.9b.63 Assuming no anomalies/surprises in file.txt: use File::Slurp; use strict; use warnings; my @lines = read_file( 'file.txt', chomp=>1 ); my %hash = map { split( /\s*=>\s*/,$_ ) } @lines; -- Charles DeRykus -- To unsubscribe, e-mail: beginne

Re: Is CGI module has bug for Win7?

2012-10-26 Thread Charles DeRykus
ter > use CGI; Or, just: binmode STDIN, ":crlf"; This is Perl's layer to implement DOS/Windows like CRLF line endings. See: perldoc perlio -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Wide character in print at D:/Perl/lib/WWW/Mechanize.pm line 2044

2012-10-23 Thread Charles DeRykus
looks correct. I have modified the Mechanize.pm @ line no. 2042 to open( my $fh, '>:utf8', $filename ). But I am not getting the desired output. Please help in getting the $mech->content in utf-8 format. Try $mech->decoded_content instead of $mech->content. HTH, C

can't post to perl.beginners

2009-11-03 Thread Charles DeRykus
Hello, I subscribed to perl.beginners via Google groups but none of my posts get through Can you help or suggest what might be amiss? -- Charles DeRykus