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
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'
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/
On Mon, Jul 20, 2015 at 6:19 AM, Vincent Lequertier wrote:
> Thank you for the help, Charles! Unfortunately, I'm not able to figure out
> how to access the element of %ordered, despite some diggings in the perldoc
> (http://perldoc.perl.org/perldsc.html).
> I can print a single e
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'
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/
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/
...
}
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/
print $ref->[$iter++];
};
my $report_dynamic = sub( my $ref = shift;
print $ref->[$iter++];
...
#MAIN_CODE START
foreach $task (@tasks) {
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/
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
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
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/
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/
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/
> ...
> 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
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
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
'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/
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) {
} ) ) { }
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/
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/
; 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
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
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 :
>
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/
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
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/
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...
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/("|
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/
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
>
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
d, then go on to other suggested sources... or not :)
TIMTOWDI
--
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
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
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
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
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
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
> 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
her parsing modules are, you certainly would be grinding
out more code.
--
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>>
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
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
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
{$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
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
y be useful:
>
use Encode::Guess;
my $decoder=Encode::Guess->guess("Grégoire");
die $decoder unless $decoder;
print $decoder->name;#---> utf8
--
Charles DeRykus
s are fairly intuitive but you can add:
use diagnostics qw/-verbose/;
for added explanations.
--
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
h more obscure:
made it past ok...
Can't close(GLOB(0x64dcf8)) filehandle: '' at...
--
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
"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
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
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&
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
$
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/
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: $!"
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/
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
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/
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
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
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/
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/
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/
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
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
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
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/
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
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/
=> 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
=> 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
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/
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
Thank you. The useful note about CORE, in particular, is new to me.
cts
--- On Sun, 6/24/12, Rob Dixon wrote:
> From: Rob Dixon
> Subject: Re: how to do a reference to a func in Math::Trig
> To: "Perl Beginners"
> Cc: "Charles Smith"
> Date: Sunday, June
thank you.
cts
--- On Sat, 6/23/12, Ron Bergin wrote:
> From: Ron Bergin
> Subject: Re: how to do a reference to a func in Math::Trig
> To: "Charles Smith"
> Cc: beginners@perl.org
> Date: Saturday, June 23, 2012, 3:28 PM
> Charles Smith wrote:
>
> [snip]
Hello Shawn, thank you for answering.
I'm sorry, I was a bit sloppy with my example and so maybe unclear about my
question ...
It's not about the precise syntax of getting a reference to a subroutine, but
rather a subroutine in a module.
For example, this pgm is clear:
#!/usr/bin/env perl
sub
Hi,
I'm experimenting with Math::Trig and would like to be able to pass the
function in as a parameter:
$f = $opts{f} || &sin;
...
&$f($w);
Undefined subroutine &main::sin called at (eval
9)[/usr/lib/perl5/5.14.2/perl5db.pl:640] line 2.
I have also tried:
$f = &Math::Trig::sin;
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
I'm trying to install UR-v0.12 - and encountered a great wizard. But I don't
have root access on my machine. I get
You are not allowed to write to the directory '/usr/lib/perl5/site_perl/5.8.8'
even though I'd entered
Your choice: [] PREFIX=~/lib/perl
Can somebody please explain to me
On Nov 1, 1:37 pm, [EMAIL PROTECTED] (Jl Post) wrote:
> On Nov 1, 9:35 am, [EMAIL PROTECTED] (Charles) wrote:
>
>
>
> > I have module from CPAN named Graph. I have created a subroutine for
> > this to pass in two arrays; x-axis and y-axis into my Graph subroutine
>
Help
Three days of head-banging the Boss has my walking papers if I
don't "get'er done"!
I have module from CPAN named Graph. I have created a subroutine for
this to pass in two arrays; x-axis and y-axis into my Graph subroutine
i.e. ; &graph( @Xvalues, @Yvalues );
My confusions is: in
se of
un-initialized value in concatenation
Presumably
due to above
print "\n\n";
print " * End of details for all devices ";
print "\n\n";
}
Just can't figure it out - any suggestions.
Thanks,
Charles.
ings as well.
It is usually best to avoid using variables which are not
local to a sub routine inside a sub routine, though there are
cases where this it is desirable and good programming practice.
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
Free Market Advocate
Web Programmer
25
blem with
write_col() or with the setup for the object $worksheet.
If it does test okay then the problem may be in the
data manipulation just before the call to write_col().
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
Free Market Advocate
Web Programmer
254 968-8328
http://www.cl
rse @ascending_indexes ];
print "\n\n";
print "Descending sort then ascending sort\n\t";
printf '%5d', $_ foreach @occ_count[ @descending_indexes ];
print "\n\t";
printf '%5d', $_ foreach @unique[ @descending_indexes ];
print "\n";
__END__
eing just a little contrite.
Charles K. Clarkson
--
Mobile Homes Specialist
Free Market Advocate
Web Programmer
254 968-8328
http://www.clarksonenergyhomes.com/
Don't tread on my bandwidth. Trim your posts.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
e):
Script: http://www.clarksonenergyhomes.com/chakrabarti.txt
Module: http://www.clarksonenergyhomes.com/chakrabarti.pm
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
Free Market Advocate
Web Programmer
254 968-8328
http://www.clarksonenergyhomes.com/
Don't tread on my bandwidth.
Hui Wang <mailto:[EMAIL PROTECTED]> wrote:
: I can make my program do its job at last, but it runs
: slowly. Can anybody tell me how to improve the running
: speed of this program?
You only provided the module. Can you supply a
working example? Something we can actually run?
HTH,
Cha
Dharshana Eswaran <mailto:[EMAIL PROTECTED]> wrote:
: The desired output should look like the following:
:
: 0x0a => 1010
: 0x23 => 00100011
:
: Can anyone suggest me for the same?
Read perlfaq4:
How do I convert between numeric representations/bases/radixes?
HTH,
Charles
ou have a solution for the remaining value.
Try to solve the rest yourself. Come back here when you get
stuck solving a step.
print 1 % 25, "\n";
print 30 % 25, "\n";
print 300 % 25, "\n";
print 1234 % 25, "\n";
print 60001 % 25, "\n";
HT
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
Free Market Advocate
Web Programmer
254 968-8328
http://www.clarksonenergyhomes.com/
Don't tread on my bandwidth. Trim your posts.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTE
- Search record for 100% field,
- Locate gi number,
- Delete that record in data.txt, and
- Close the file.
There's nothing tricky about that either. In fact, many of
those steps are the same as the one's above. Perl is an excellent
language choice for coding this type of a
I.B. wrote:
: unfortunately I have to use regex to solve this problem.
Why do you have to use a regex?
Charles K. Clarkson
--
Mobile Homes Specialist
Free Market Advocate
Web Programmer
254 968-8328
Don't tread on my bandwidth. Trim your posts.
--
To unsubscribe, e-mail: [
aesthetically pleasing.
use Data::Dumper 'Dumper';
print Dumper [EMAIL PROTECTED];
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
Free Market Advocate
Web Programmer
254 968-8328
Don't tread on my bandwidth. Trim your posts.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For addi
Vishwanath Chitnis wrote:
: is there any other way other than above mentioned to do this?
How can we possibly tell with only those lines?
Show more code. Something we can run that will illustrate
your problem.
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
Free Market Advocate
#x27;s just what I'm looking for, thanks so much. :-)
Hope this helps!
--Tom Phoenix
Stonehenge Perl Training
--
----
Charles Farinella
Appropriate Solutions, Inc. (www.AppropriateSolutions.com)
[EMAIL PROTECTED]
vo
1 - 100 of 880 matches
Mail list logo