providing perl api for C library

2022-12-09 Thread Henry R
Hello list, I have written a C library which encrypts the data stored in object storage like S3. If I want to provide it with a perl OO interface what's the right way? such methods like: $data->encrypt("input.sth"); $data->decrypt("input.sth"); Thanks. -- To unsubscribe, e-mail: beginners-uns

RE: Regex not working correctly

2013-12-11 Thread vijaya R
Hi, You can try the below pattern. if($line=~/([0-9]{3,})/gs) { print $1; } Thanks, Vijaya -- From: punit jain Sent: 12/11/2013 9:07 PM To: beginners@perl.org Subject: Regex not working correctly Hi, I have a requirement where I need to capture phone number

Re: is it possible to get only emails from this list for threads that I've started or replied ?

2013-05-28 Thread R. S.
Hello Gustavo, Tuesday, May 28, 2013, 2:05:27 AM, you wrote: > How do you will reply a message, if you will not receive it ? I meant a setting that only the messages that are reply to me are send to my email and those from threads in which there is my reply also be send like on web forum

is it possible to get only emails from this list for threads that I've started or replied ?

2013-05-27 Thread R. S.
I've send request to beginners-help but there seems to be no such command. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

dmake can't find config.h, and collector throws error when trying to compile perl-static.exe (perl-5.18.0 / mingw)

2013-05-26 Thread R. S.
dmake -f makefile.mk == del /f config.h Can not find D:\perl\win32\config.h. copy config_H.gc config.h Number of copied files: 1. It is strange because both of these files are present in the win32 dir but only one is found. Maybe the version of dmake I use is outdated

Re: Cheapest Method to Read Files?

2012-07-19 Thread Sheppy R
6 CPU) @ 21739.13/s (n=1) So it looks like awk was accounting for less than half of total time. Keeping it in the house and running things through perl definitely seems like the way to go here. Thanks again! On Thu, Jul 19, 2012 at 8:21 PM, Jim Gibson wrote: > > On Jul 19, 2012, at 5:10 P

Cheapest Method to Read Files?

2012-07-19 Thread Sheppy R
I'm wondering what is the least resource intensive way to read just one item of a file. I'm looking at one of two options (I'm assuming there are more that I'm just not familiar with). The first idea is to run grep through a system command. The second is to open the file for reading then scan ea

Re: extracting email addresses from a file

2011-11-29 Thread Sheppy R
Couldn't you just use the non-whitespace character to capture everything before and after the @ symbol? s/^.*\s(\S+@\S+)\s.*$/$1/

Re: regex

2011-11-04 Thread Sheppy R
This should do it - m/Cell (\d+)(.*), HEH/ On Fri, Nov 4, 2011 at 1:42 PM, Chris Stinemetz wrote: > I am trying to match a line that has HEH in it. > > I would also like to store the number follow CELL in memory variable $1 > and store everything following the number and upto excluding ", HEH"

Re: Stop the mail to me

2011-10-07 Thread Sheppy R
Stop spamming us with stop mail requests and use the instructions included at the bottom of the email to unsubscribe. To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ On Fri, Oct 7, 2011 at 6:24 AM, ganesh vigne

Re: 3-argument open on STDIN

2011-08-23 Thread Bryan R Harris
>>>>>>>> "Bryan" == Bryan R Harris writes: >>> >>> Bryan> How can I use the "safe" 3-argument open and still be able to read >>> off >>> a >>> Bryan> pipe? >>> >>> You don'

Re: 3-argument open on STDIN

2011-08-22 Thread Bryan R Harris
>>>>>> "Bryan" == Bryan R Harris writes: > > Bryan> How can I use the "safe" 3-argument open and still be able to read off > a > Bryan> pipe? > > You don't. 2-arg open has to be good for something. > > And 2-arg

3-argument open on STDIN

2011-08-22 Thread Bryan R Harris
open(my $fh,"<",$_[0]) or die "$me: Couldn't open $_[0]: $!\n"; my(@fc) = <$fh>; close($fh) or die "$me: Couldn't close $_[0]: $!\n"; if ($fc[0] =~ /\r/) { @fc = map { s/\r\n?/\n/g; split /(?<

3-argument open on STDIN

2011-08-17 Thread Bryan R Harris
open(my $fh,"<",$_[0]) or die "$me: Couldn't open $_[0]: $!\n"; my(@fc) = <$fh>; close($fh) or die "$me: Couldn't close $_[0]: $!\n"; if ($fc[0] =~ /\r/) { @fc = map { s/\r\n?/\n/g; split /(?<

Re: How to run a perl script in background on Windows?

2011-08-03 Thread Sheppy R
If you are trying to run this at Startup you can set up the AutoExnt service to run a .bat that launches the .pl file. @Timothy - Sorry for the reply. On Wed, Aug 3, 2011 at 6:43 PM, timothy adigun <2teezp...@gmail.com> wrote: > Hi Jose, > If you are using ActiveState you could use wperl.exe fr

Re: matplotlib

2011-06-28 Thread Bryan R Harris
t;> some work at home and cannot afford the considerable cost to buy >>>> commercial packages for personal use. >>>> >>>> Wernher >>>> >>>> On Tue, Jun 28, 2011 at 6:58 PM, Wernher Eksteen >>>> wrote: >>>&g

matplotlib

2011-06-22 Thread Bryan R Harris
I much prefer perl to python given my recent forays into that language (python's regex is awful!), however it has an excellent plotting package that is very similar to matlab but supports things like marker alphas. It's called matplotlib, and requires scipy and numpy. PDL is the closest thing I

Re: memory doesn't free after lexical block

2011-05-18 Thread Sheppy R
Uri, how would you change the original code to get it to free up memory? I've run into this issue myself quite a few times. I've also seen perl consume an entire cpu core without even trying. Could you rework the original scriptlet to show how you would free the memory at the end or direct us to

Re: Building an image one pixel at a time

2011-03-30 Thread Bryan R Harris
> On 11-03-30 11:36 AM, Bryan R Harris wrote: >> >> >> All, >> >> Is it possible to build an image one pixel at a time, e.g. to have a data >> structure that looks like this: >> >> $i{channel}[x][y] >> >> ... where channel is r,

Building an image one pixel at a time

2011-03-30 Thread Bryan R Harris
All, Is it possible to build an image one pixel at a time, e.g. to have a data structure that looks like this: $i{channel}[x][y] ... where channel is r,g,b, or a, and x and y are the pixel coordinates. Then, once I have the data filled out, call some module and write out a .png file? - Bryan

Re: SDL beginner question

2011-01-21 Thread Sheppy R
I would recommend using the IRC chat or SDL mailing list found here: http://sdl.perl.org/index.html At least one of the members that is working on the development side is coding on a Mac as well (Unfortunately I don't remember the name). kthakore is generally in the IRC channel most of the time a

Re: Perl for windows Problem

2011-01-05 Thread Sheppy R
*As usual... forgot to reply to all...* Check out Sys::Info and the other Sys::Info based modules. These should do what you need. http://search.cpan.org/search?query=sys%3A%3Ainfo&mode=all On Thu, Jan 6, 2011 at 12:16 AM, sync wrote: > Hi: > > > Could I get the windows information( like CPU

Re: Increment Operators

2011-01-02 Thread Sheppy R
Sorry, forgot to reply-to-all again :( $a *= 2; Basically translates to this: $a = $a * 2; just like $b += 1; translates to: $b = $b + 1; On Sun, Jan 2, 2011 at 7:00 PM, J. S. John wrote: > Hi all, I'm new to Perl. The only other language I know is > Matlab/Octave and I'm still working my

Re: Syntax Errors

2010-12-26 Thread Sheppy R
Strawberry Perl under Padre on a Windows system will give Syntax errors (Running from both the command-line and in Padre itself). Chances are this is where Bill is getting them from, probably just one of the differences between *nix and Windows. @Bill - I'm not seeing any problems when I copy and

Re: Writing 3D games with Perl... How's the Performance?

2010-12-25 Thread Sheppy R
Going through some of the examples in this book. Does anyone know where I can find the data files used? It is my understanding that this manual is actually a work in progress, but it doesn't look like the data files have been posted on sdl.perl.org yet. @Brian, sorry for the double... forgot to

Re: XML Challenge Cannot

2010-12-19 Thread Liam R E Quin
On Sat, 2010-12-18 at 13:16 +0530, Chaitanya Yanamadala wrote: > Thank you for the reply. Thank u for letting me know an alternative for > this. But there is a problem with what you have sent. > It is not just removing of the bottom group tag that is required. I'm not going to do your school hom

Re: Linux Uptime

2010-12-16 Thread Sheppy R
http://search.cpan.org/~burak/Sys-Info-Base-0.73/lib/Sys/Info/OS.pm#uptime Sys::Info::OS has an uptime() method. On Thu, Dec 16, 2010 at 8:32 PM, Matt wrote: > I have a perl script but I want to exit it if the uptime on the server > is less then say an hour. Any idea how I would get uptime wit

Re: Perl, pattern matching, substitution

2010-11-13 Thread Sheppy R
I've had similar issues and the \Q \E flags didn't fix it. One thing I've done to fix an issue where regex metacharacters are being caught is to do a replace on all of the characters to include a \ right in front. Something like this: open (my $FILE, "<", $file) or die "$!\n"; my @lines = <$FILE

Re: chromatic's "Modern Perl" book is out.

2010-11-12 Thread Sheppy R
Yes, follow the link, you can purchase a paper book. On Fri, Nov 12, 2010 at 5:18 PM, David Christensen < dpchr...@holgerdanske.com> wrote: > Shlomi Fish wrote: > >> chromatic's "Modern Perl" book is finally out and is available as free >> PDFs downloads: >> > > Is a book version available? > > >

Re: reading data from a file and put in a new file

2010-11-09 Thread Sheppy R
The "Global symbol "@val" requires explicit package name at test.pl ." should be fixed by declaring @val with 'my': my @val = **something**; On Tue, Nov 9, 2010 at 2:37 PM, Shlomi Fish wrote: > Hi Lynx, > > I'm CCing my reply to the list. Next time, please use the GMail "reply to > all" > featu

Re: Chomp help...

2010-11-08 Thread Sheppy R
You could try doing this with a regex: $html_content =~ s/\n//g; This would look for any new-line ("\n") and replace it with nothing. The g at the end tells it to do this globally, so all instances of \n would be removed. On Mon, Nov 8, 2010 at 4:04 PM, Bobby wrote: > Hi, > > I'm having issue

redirect STDERR

2010-11-02 Thread Bryan R Harris
I have these lines in my script: ** for my $handle (*STDIN, *STDERR) { open($handle, "+$outfile") or die "$me: Couldn't open $outfile: $!\n"; $| = 1; # and don't buffer it ** I decided I want STDERR to also be

unary not?

2010-07-15 Thread Bryan R Harris
Out of curiosity, is there a unary not operator in perl? i.e. "$a = $a+1" is the same as "$a++" Is there a similarly short form of "$a = !$a"? Like "$a!!"? (tried it and it didn't work.) - Bryan -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-m

Re: \1 in character class?

2010-07-14 Thread Bryan R Harris
Wow, an impressive set of responses -- thanks Erez, Chas, Chris, C., Shawn, and Jennifer. I think most of the response pointed to "non-greedy" matches, is that right? Are those deprecated or discouraged? Thanks again. - Bryan > On Wed, Jul 14, 2010 at 00:50, C.DeRykus wrote: > snip >>> s

\1 in character class?

2010-07-13 Thread Bryan R Harris
I'm trying to temporarily deal with simple quoted strings by turning: data: "this is a string" more: "this is another" into... data: "this is a string" more: "this is another" I thought this would work: s/(['"])([^\1]*)\1/${1}.despace($2).$1/gse; sub despace { my $t = shift;

Use of uninitialized value in print at...

2010-06-03 Thread Bryan R Harris
Seems like the first time I run a new script I *always* get an error message something like this: "Use of uninitialized value in printf at /Users/harrisb/Library/perl/matc line 414." The problem is usually I'm printing several things, so I have no idea which variable wasn't initialized from t

Re: append to a hash?

2010-05-20 Thread Bryan R Harris
>>>>>> "BRH" == Bryan R Harris writes: > > BRH> I have code that looks like this: > > BRH> ** > BRH> if ($props =~ /\S/) { > BRH> %{$ptr[-1]->[-1]} = ($props =~ m/\s*([^=]+)=&q

append to a hash?

2010-05-20 Thread Bryan R Harris
I have code that looks like this: ** if ($props =~ /\S/) { %{$ptr[-1]->[-1]} = ($props =~ m/\s*([^=]+)="([^"]+)"/g); } ** My problem is that I only want to append the properties and their values to that hash, not replac

RE: beginners Digest 4 May 2010 07:42:13 -0000 Issue 3941

2010-05-04 Thread FRASER, KAREN R.
How do I unsubscribe from this? I've sent at least three emails to beginners-digest-unsubscr...@perl.org following the instructions in "Administrivia: To subscribe to the digest, e-mail: To unsubscribe from the digest, e-mail: To post to the list, e-mail: " -Ori

Re: why on while?

2010-03-08 Thread Bryan R Harris
>>>>>> "BRH" == Bryan R Harris writes: > > BRH> Much to my chagrin I realized this morning that this notation: > > BRH> while() { > > BRH> evaluates as: > > BRH> while(defined($_ = )) { > > BRH> ..

why on while?

2010-03-08 Thread Bryan R Harris
Much to my chagrin I realized this morning that this notation: while() { evaluates as: while(defined($_ = )) { ... and NOT as: while(defined(local $_ = )) { I had a subroutine that was set up to read and parse a file, but it was trashing the value of $_ out in the main program!

anonymous hash slices

2010-02-24 Thread Bryan R Harris
Just as an academic exercise, I thought I should be able to do this: ** @a=(l=>35,k=>31,r=>7,k=>6); @r=qw/l r r k/; # make an anonymous hash using @a, then grab values from it using @r as keys @a...@a}{@r}; print join(

Re: octal?!

2010-02-22 Thread Bryan R Harris
> On Fri, Feb 19, 2010 at 10:34 PM, Bryan R Harris > wrote: >> >> >>> >>>> Is there any way to keep perl's eval from interpreting numbers starting >>>> with >>>> "0" as octal? >>> >>> Stringif

Re: octal?!

2010-02-21 Thread Bryan R Harris
> Thanks for not top-posting and for following E-mail netiquette. See below for > my response. Uh, sure. Most people don't get thanked for this, so I'm curious what prompted that. > On Sunday 21 Feb 2010 05:01:12 Bryan R Harris wrote: >>> On Saturday 20 Feb 2010 0

Re: octal?!

2010-02-21 Thread Bryan R Harris
> Bryan R Harris wrote: >> >>> Bryan R Harris wrote: >>>> This is unintuitive: >>>> >>>> perl -e 'print "> "; while(<>) {print(( eval $_ )[-1], "\n> ")}' >>>> >>>> ... t

Re: octal?!

2010-02-20 Thread Bryan R Harris
> On Saturday 20 Feb 2010 04:53:18 Bryan R Harris wrote: >> This is unintuitive: >> >> perl -e 'print "> "; while(<>) {print(( eval $_ )[-1], "\n> ")}' >> >> ... then enter 2*012. It prints "20". 2*12 is

Re: octal?!

2010-02-20 Thread Bryan R Harris
> Bryan R Harris wrote: >> >> This is unintuitive: >> >> perl -e 'print "> "; while(<>) {print(( eval $_ )[-1], "\n> ")}' >> >> ... then enter 2*012. It prints "20". 2*12 is obviously 24, but perl&#

Re: octal?!

2010-02-19 Thread Bryan R Harris
> >> Is there any way to keep perl's eval from interpreting numbers starting >> with >> "0" as octal? > > Stringify them ? > 2 * '012' is 24. Manually? We could have thousands of them. How do I stringify them when they may potentially be in the middle of an expression? eg. 75+32*(15+052/3)

octal?!

2010-02-19 Thread Bryan R Harris
This is unintuitive: perl -e 'print "> "; while(<>) {print(( eval $_ )[-1], "\n> ")}' ... then enter 2*012. It prints "20". 2*12 is obviously 24, but perl's interpreting that "012" as octal. We sometimes have our numbers zero padded to make the columns line up, they're not octal. Is there

RE: Send mail using SSL

2010-01-12 Thread Gurunandan R. Bhat
be I am not careful enough to find it. > > Is there any module easy to send attachments over ssl? > > -Original Message----- > From: Gurunandan R. Bhat [mailto:g...@dygnos.com] > Sent: Tuesday, January 12, 2010 2:52 PM > To: Thomas Yan > Cc: beginners@perl.org > Subjec

Re: Send mail using SSL

2010-01-11 Thread Gurunandan R. Bhat
Use Email::Sender::Transport::SMTP > a > I want to send mail using ssl with smtp server. Does Mail::Sender support > SSL? Or must I use Net::Smtp::SSL ? > > Regards, > Thomas. > >

Re: being smart about script structure

2009-12-22 Thread Bryan R Harris
> Bryan R Harris wrote: > >>> perl -wle ' >>> >>> sub inc{ ++$_ for @_ } >>> >>> my @x = 1 .. 5; >>> >>> inc @x; >>> >>> print "@x"; >>> ' >>> 2

Re: being smart about script structure

2009-12-21 Thread Bryan R Harris
> On Wed, 16 Dec 2009 17:47:16 -0600, Bryan R Harris wrote: >>> Okay, here's one I struggle with often -- is one of these better than >>> the other? >>> >>> ** >>> A. >>>

Re: being smart about script structure

2009-12-21 Thread Bryan R Harris
> On Wed, 16 Dec 2009 17:47:16 -0600, Bryan R Harris wrote: >> Okay, here's one I struggle with often -- is one of these better than >> the other? >> >> ** >> A. >> if ( isFla

Re: being smart about script structure

2009-12-21 Thread Bryan R Harris
> Wagner, David --- Senior Programmer Analyst --- CFS wrote: > >> You pass as a refernce as ni >> called_sub(\...@d); >> Now when you update, you are updating @d and not a copy. > > No need to use a reference for that: > > perl -wle ' > > sub inc{ ++$_ for @_ } > > my @x = 1 .. 5; >

Re: being smart about script structure

2009-12-21 Thread Bryan R Harris
>> What's the difference between pointers and references?  Where can I read >> about that difference? > > The key difference in my mind is this: Perl references are defined in > terms of perl datatypes. C pointers are defined (more or less) in > terms of memory locations. > > If you think about

Re: being smart about script structure

2009-12-21 Thread Bryan R Harris
>> Is there any way to make a new variable, @something, that is just another >> name for the array that was passed in by reference? Since I'm building a >> complex data structure, having to include all those @{}'s can get annoying. > > Elements of a hash referenced by $h can be accessed by $h->

Re: being smart about script structure

2009-12-16 Thread Bryan R Harris
>> No other perl programmers here, unfortunately.  Good advice, though. > > Why don't you post your ideas here for criticism then? I wouldn't post > an entire several hundred line script, but you could post your > specification and your plan for writing a code which met said > specification. If

Re: being smart about script structure

2009-12-16 Thread Bryan R Harris
A couple responses, mixed in below: > 2009/12/11 Bryan R Harris : >>>> Seems like a waste to do step 2 in a subroutine since we only do it once, >>>> but it does fill the main body of the script with code-noise that makes it >>>> harder to debug overall

Re: being smart about script structure

2009-12-16 Thread Bryan R Harris
you have any questions and/or problems, please let me know. > Thanks. > > Wags ;) > David R. Wagner So let's say I pass a reference to an array: my @d = (1,2,3); called_sub(\...@d); ... but then in called_sub, accessing that gets a lot "noisier", right?

Re: being smart about script structure

2009-12-11 Thread Bryan R Harris
>> Seems like a waste to do step 2 in a subroutine since we only do it once, >> but it does fill the main body of the script with code-noise that makes it >> harder to debug overall logic problems...  Not much logic here, but >> certainly in more complex scripts. > > A waste of what exactly? Yo

Re: being smart about script structure

2009-12-11 Thread Bryan R Harris
> Bryan R Harris wrote: >> >> I'm not even sure how to ask this question, but here goes: >> >> I struggle knowing how to structure my code, what things belong as their own >> subroutines and what things can stay in the main script. How do the smart &g

being smart about script structure

2009-12-11 Thread Bryan R Harris
I'm not even sure how to ask this question, but here goes: I struggle knowing how to structure my code, what things belong as their own subroutines and what things can stay in the main script. How do the smart guys make these decisions? For example, let's say I need to: 1. Read a complex fil

On map

2009-11-10 Thread Bryan R Harris
I have a curiosity maybe someone here can help with. This code: @a=(1,2); map { $_ = 3 } @a; print join(",", @a), "\n"; ... prints "3,3". That map is changing the @a array as it goes through it. Good. Now this: %a=(1,2); map { $_ = 3 } keys %a; print join(",", keys(%a)), "

Re: printf with currency symbols

2009-10-26 Thread Bryan R Harris
> Robert Citek wrote: >> Not sure if there is a better way. My guess is that there is probably >> some module to convert float to currency and then print it as a >> string. But a quick Google didn't turn up anything. > > Here' why (extracted from `perldoc perllocale`): > >Category LC_MONET

printf with currency symbols

2009-10-26 Thread Bryan R Harris
Is there a good way to do printf's with currency symbols? I've tried this: printf "Total: \$%10.2f\n", $total; But it puts the dollar sign way out front (ugly). I want it to look like: Total:$24.15 Is there a way to do this without getting all messy like this? printf "Total:%10s\

compressed data embedded in script

2009-10-05 Thread Bryan R Harris
I have about 60 MB of text data I want to include at the bottom of a script. 60 MB is too big for us, but compressed it would be probably only 3-6 MB which is much better. Is there any way to put gzipped data in the DATA section of a script, and have the main body of the script conveniently re

Re: decimal to binary?

2009-09-23 Thread Bryan R Harris
>>>>>> "BRH" == Bryan R Harris writes: > > BRH> Maybe this is just my own ignorance on big-endian vs. little endian, > but > BRH> this code: > > BRH> print "big-endian: ", unpack("H*", pack("d"

Re: decimal to binary?

2009-09-23 Thread Bryan R Harris
> Bryan R Harris wrote: >> >> I need to convert a number like this: -3205.0569059 >> ... into an 8-byte double (big and little endian), e.g. 4f 3e 52 00 2a bc 93 >> d3 (I just made up those 8 byte values). >> >> Is this easy in perl? Are long a

Re: decimal to binary?

2009-09-23 Thread Bryan R Harris
> From: Uri Guttman > >>>>>>> "BM" == Bob McConnell writes: >> >> BM> From: Bryan R Harris >>>> >>>> I need to convert a number like this: -3205.0569059 >>>> ... into an 8-byte double (big and li

Re: decimal to binary?

2009-09-23 Thread Bryan R Harris
>> I need to convert a number like this: -3205.0569059 >> ... into an 8-byte double (big and little endian), e.g. 4f 3e 52 00 2a > bc 93 >> d3 (I just made up those 8 byte values). >> >> Is this easy in perl? Are long and short ints easy as well? > > The sprintf() family is your friend. I

decimal to binary?

2009-09-23 Thread Bryan R Harris
I need to convert a number like this: -3205.0569059 ... into an 8-byte double (big and little endian), e.g. 4f 3e 52 00 2a bc 93 d3 (I just made up those 8 byte values). Is this easy in perl? Are long and short ints easy as well? Thanks! - Bryan -- To unsubscribe, e-mail: beginners-un

Re: Burnt Camel Club

2009-09-22 Thread Bryan R Harris
> On Mon, Sep 21, 2009 at 10:09 PM, Randal L. Schwartz > wrote: > >> >> Yup. I care when it might harm others. Otherwise, I tend not to >> talk... plenty of other people here to give answers. I only doublecheck >> answers anymore. >> > Yes, that is why this list gets 5 emails on average per

Re: best way to get number of elements in list value

2009-09-22 Thread Bryan R Harris
> On Tue, Sep 22, 2009 at 12:46:59PM +0400, Roman Makurin wrote: >> Hi All! >> >> right now im doing it in following way: >> >> $size = @{[func_that_return_list_value]}; >> >> is there any best way to do it ? > > $size =()= func_that_return_list_value; "goatse"? Can you explain how perl in

Re: "$| = 1" ???

2009-09-10 Thread Bryan R Harris
>>>>>> "BRH" == Bryan R Harris writes: > > BRH> Curiously the most helpful people on this list seem to think the > BRH> perldoc system is great, but I've always found it to be rather > BRH> hard to use. If I need to figure out what &

Re: "$| = 1" ???

2009-09-10 Thread Bryan R Harris
>> "ES" == Erez Schatz writes: > >>> $| is a special variable. All perl special variables are listed in >>> perldoc perlvar. See that document for a full explanation. > > ES> This isn't really helping, sorry. > > sorry, but pointing someone to the docs is helping more than directly > ans

execute in another terminal

2009-09-04 Thread Bryan R Harris
Not exactly a perl question, but I'd certainly like to use this with perl... Is it possible from one terminal window in linux (RH) to tell another terminal to execute a shell command, e.g. perl script, just as if you typed it there? - Bryan -- To unsubscribe, e-mail: beginners-unsubscr..

Seeing if any element of an array is in the current line

2009-08-13 Thread Mazza, Glen R.
Hello, I'm trying to write a simple Perl script to output certain lines from a logfile that contain any of a few phrases. I have two questions on the script I've done: use strict; use warnings; open my $infile, '<', $ARGV[0] or die "Can't open $ARGV[0]"; # Put in the badlist words tha

Re: ||= operator

2009-08-10 Thread Bryan R Harris
> Admin wrote: >> Shawn H. Corey wrote: >>> Admin wrote: Hi there, is there a page that explains the ||= operator and similar operators? google is not quite finding the special characters in the first 10 hits. >>> >>> See http://perldoc.perl.org/perlop.html#Assign

Re: two questions

2009-08-06 Thread Bryan R Harris
> On Thu, Aug 6, 2009 at 11:54, Bryan R Harris > wrote: > snip >> Now that's just impressive. >> >> For some reason the back of my brain thinks if I knew perl as well as you >> two seem to I could easily make all the money I wanted.  Just between you >

Comma operator

2009-08-06 Thread Bryan R Harris
; So this: $_ = "dogs and cats"; $r = s/o/i/g, s/s/y/g; print "$r: $_\n"; ... prints "1: digy and caty". Why doesn't it print a "2" instead of a "1"? It did 2 replaces of s to y... If I change the second line to read: $r = s/s/y/g; ... it

Re: two questions

2009-08-06 Thread Bryan R Harris
> On Thu, Aug 6, 2009 at 11:15, Bryan R Harris > wrote: >> >>>> According to the FAQ you want to do it like this: >>>> >>>> s/^\s+//, s/\s+$// for $var; >> >> >> I can't find documentation of this notation anywhere, i.e.

FW: two questions

2009-08-06 Thread Bryan R Harris
>> According to the FAQ you want to do it like this: >> >> s/^\s+//, s/\s+$// for $var; I can't find documentation of this notation anywhere, i.e. the comma between statements with a trailing for. John, where do you find all this cool stuff? - Bryan -- To unsubscribe, e-mail: beginner

Re: better readline?

2009-08-06 Thread Bryan R Harris
> On Wed, Aug 5, 2009 at 14:52, Bryan R Harris > wrote: > snip >> I didn't change anything, actually -- it never printed the "8/2 Updated >> database" string.  It prompted with the "Enter a date and note:", I typed >> "Uh." and that

What happened to url http://beginners.perl.org/

2009-08-05 Thread FRASER, KAREN R.
I checked link http://lists.cpan.org/showlist.cgi?name=beginners "The beginners Mailing List" It references link http://beginners.perl.org/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ -- To unsubscr

Re: better readline?

2009-08-05 Thread Bryan R Harris
> On Tue, Aug 4, 2009 at 16:35, Bryan Harris wrote: > snip >>> while ( defined (my $answer = $term->readline("Enter a date and >>> note:", "8/2 Updated database")) ) { >>> print "you said $answer\n"; >>> } >> >> >> Thanks for the response Chas -- oddly it doesn't work.  This is what it >> print

better readline?

2009-08-03 Thread Bryan R Harris
I'm writing a little script where the user enters some data via keyboard. The script in some cases can guess what the user will want to enter, but I'd like the user to be able to override what the computer has guessed. For example, the computer thinks the user will enter "8/2 Updated database",

Re: On using $_ in subroutines

2009-07-29 Thread Bryan R Harris
> Bryan R Harris wrote: >>> Bryan Harris wrote: >>>> John W. Krahn wrote: >>>>> Bryan Harris wrote: >>>>>> ... but by modifying $_ I was clobbering $_ elsewhere in the larger >>>>>> program! >>>>> Yes b

Re: On using $_ in subroutines

2009-07-28 Thread Bryan R Harris
> On Mon, Jul 27, 2009 at 09:49, Bryan Harris wrote: > snip >>> Yes because $_ is a special global variable.  This effect is called >>> "action at a distance" which is why it is better to use named lexically >>> scoped variables instead of $_. >> >> I have the Perl Bookshelf on CD (and perldoc,

Re: On using $_ in subroutines

2009-07-28 Thread Bryan R Harris
> Bryan Harris wrote: >> >> John W. Krahn wrote: >>> >>> Bryan Harris wrote: ... but by modifying $_ I was clobbering $_ elsewhere in the larger program! >>> Yes because $_ is a special global variable. This effect is called >>> "action at a distance" which is why it is better t

Re: evaluate for max and min value in array

2009-07-22 Thread Bryan R Harris
> You can fing max and min value as, > > my @ar = (1,2,3,4,58,9,2,1); > my $max = (sort { $b <=> $a } @ar)[0]; > my $min = (sort { $a <=> $b } @ar)[0]; If your arrays could be very large, it's a waste of cycles to sort the list then throw most of that effort away. You could do: **

Re: Install DBD::Sybase

2009-07-21 Thread Gurunandan R. Bhat
Ooops - Sorry!! I sent an HTML reply and my links went away. Here is my reply with the links preserved: I assume you have installed the freetds library. Please follow the solutions given here: http://lists.ibiblio.org/pipermail/freetds/2006q3/020587.html and here: http://www.perlmonks.org/?node

Re: Install DBD::Sybase

2009-07-21 Thread Gurunandan R. Bhat
On Tue, 2009-07-21 at 14:38 +0800, Jenn G. wrote: You must install the freetds library before compiling DBD::Sybase? > Hello, > > I follow the steps on this link to install and use DBD::Sybase for MSSQL: > http://www.perlmonks.org/?node_id=392385 > > But when configure I got: > > BLK api NOT

Re: module for accessing MSSQL

2009-07-07 Thread Gurunandan R. Bhat
If you are on a Linux server then DBD::Sybase is your best bet. It uses freetds to connect to MS-SQL server. If on a Windows then DBD::ODBC is your friend. REgards Guru On Tue, 2009-07-07 at 16:11 +0800, practicalp...@gmail.com wrote: > Hello, > > what's the standard module for accessing MSSQ

Re: Substitution question

2009-07-01 Thread Gurunandan R. Bhat
On Tue, 2009-06-30 at 22:47 -0700, John W. Krahn wrote: > That should be: > > $current_path =~ s|/|\\|g; Oh!! Did not know you could use '|' as a pattern delimiter. Regards

Re: Substitution question

2009-06-30 Thread Gurunandan R. Bhat
Are you sure that your substitution works? With the pattern you have quoted, you should be getting a "Search pattern not terminated" error. To answer your other question, patterns to search must be enclosed inside '/'s (forward slashes). You can change pattern delimiters then you must precede th

Re: Rendering data structures using CGI::Application

2009-06-29 Thread Gurunandan R. Bhat
27;templatefile.tpl', die_on_bad_params => 0); $tpl->param( MESSAGES => $messages, STACK => $stack, ); return $tpl->output; In your template file HTH On Mon, 2009-06-29 at 23:51 -0400

Re: Rendering data structures using CGI::Application

2009-06-29 Thread Gurunandan R. Bhat
How do you want the output to look? If you write in a sample output, I could help with the template to generate that output Regards On Mon, 2009-06-29 at 22:56 -0400, Steve Bertrand wrote: > I've been stuck for the last three hours trying to render the following > data structure into my browser

Re: Need help with Mail::Sender

2009-06-26 Thread Gurunandan R. Bhat
In my limited experience, I have had no issues with Email::MIME::CreateHTML. It also creates an object that Email::Sender can deliver. Do try it. REgards Gurunandan On Fri, 2009-06-26 at 17:36 +0200, Jenda Krynicky wrote: > Yes, the problem is very simple. Each mail client handles this > dif

Re: Is less than Regex woes

2009-06-21 Thread Gurunandan R. Bhat
I am sure that someone will write a regex for you that will work. However, why not use Mail::Log::Parse::Postfix (this is a Postfix log right?) and getting the parameters you want is as easy as $logline->{to} .. well almost :) Regards Gurunandan On Sun, 2009-06-21 at 14:54 +0100, EASY buzzho

  1   2   3   4   5   6   7   8   9   10   >