Re: how to can measure my level of knowledge?

2024-05-31 Thread Rob Coops
Hi William, Here are my two cents after nearly 30 years of writing code in many different languages. Writing in any functional language is exactly the same as in every other functional language. The easiest way to learn and improve is by learning to break down your problem into manageable steps.

Re: How to reboot?

2024-01-15 Thread hw
On Sat, 2024-01-13 at 22:53 +, Tim Lewis via beginners wrote: > To send email to text for the main carriers in the US: > AT&T > Compose a new email and enter the recipient's 10-digit wireless number, > followed by @txt.att.net. > T-Mobile > Write a new email message. > Enter the recipients T-M

Re: How to reboot?

2024-01-13 Thread Lars Noodén via beginners
If you go the e-mail route for signalling, you can have Perl scripts on both ends using Crypt::OpenPGP to sign and/or encrypt the commands. Other options like XMPP were mentioned. Maybe one of the MQTT modules would be suitable. /Lars -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org

Re: How to reboot?

2024-01-13 Thread hw
On Sat, 2024-01-13 at 17:09 +, Tim Lewis via beginners wrote: > You bring an excellent point about the ability to spoof the email address. > In my case the email that for the server is not made public, but that is a > vulnerability. I will have to read up on pwgen. That sounds like a good >

Re: How to reboot?

2024-01-13 Thread hw
On Sat, 2024-01-13 at 08:49 -0600, twlewis via beginners wrote: > Hi hw, I had a similar situation in which I travelled. I wanted to > lock down the ufw firewall but be able to allow certain IP addresses > based on the hotel IP or my cell service IP. To that I developed > Perl that would check my

Re: How to reboot?

2024-01-13 Thread hw
On Sat, 2024-01-13 at 10:24 +0530, Andinus via beginners wrote: > hw @ 2024-01-12 18:49 +01: > > > Thanks, I thought about sudo and figured it needs a password being > > entered. If that works without, I'll start programming and test if > > something else gets in the way :) > > You can configure

RE: How to reboot?

2024-01-13 Thread twlewis via beginners
Hi hw, I had a similar situation in which I travelled. I wanted to lock down the ufw firewall but be able to allow certain IP addresses based on the hotel IP or my cell service IP. To that I developed Perl that would check my smtp account. The script is controlled through a cron job that run

Re: How to reboot?

2024-01-12 Thread Andinus via beginners
hw @ 2024-01-12 18:49 +01: > Thanks, I thought about sudo and figured it needs a password being > entered. If that works without, I'll start programming and test if > something else gets in the way :) You can configure sudo to not ask for a password. -- To unsubscribe, e-mail: beginners-unsubs

Re: How to reboot?

2024-01-12 Thread hw
On Fri, 2024-01-12 at 21:39 +0530, Andinus via beginners wrote: > hw @ 2024-01-12 14:16 +01: > > > But how can I reboot/restart the computer from the xmpp client? I > > don't want the xmpp client to run as root all the time. I would use > > something like > > > > > > system('shutdown', '-r', '

Re: How to reboot?

2024-01-12 Thread Andinus via beginners
hw @ 2024-01-12 14:16 +01: > But how can I reboot/restart the computer from the xmpp client? I > don't want the xmpp client to run as root all the time. I would use > something like > > > system('shutdown', '-r', 'now'); > > > in the xmpp client, and that does require root privileges. To make >

Re: How to can develop a program

2022-08-05 Thread hw
On Mon, 2022-08-01 at 14:50 -0600, William Torrez Corea wrote: > On Mon, Aug 1, 2022 at 8:16 AM Christian Walde > > wrote: > > > On Sat, 23 Jul 2022 21:03:18 +0200, William Torrez Corea < > > willitc9...@gmail.com> wrote: > > > > My goal: I want to create > > > > > > Being that you barely know

Re: How to can develop a program

2022-08-05 Thread Mike
I agree.  Roadmap is good.  I even gave him a starting roadmap, but I think he is just looking for the answer.  Which means he is going to be disappointed for sure. Mike On 8/2/22 03:41, Ruprecht Helms (privat) wrote: for bigger developing-project the best thing is a roadmap, because

Re: How to can develop a program

2022-08-03 Thread Philip Parzygnat
For PDF related development one valuable resource is https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/pdfreference1.7old.pdf I don’t have any experience in this but investigated many years ago to automate digital publication. Maybe it will help. I’m sure Perl can be applied but as

Re: How to can develop a program

2022-08-02 Thread Ruprecht Helms (privat)
First you need the roadmap of what you want to do. The other is to read one or both of the mentioned book below. Or book about beginning perl from the Oreily-Distributor. Maybe the book "Effective Perl Programming" from Joseph N. Hall can be an additional option. As mentioned in another mail f

Re: How to can develop a program

2022-08-02 Thread William Torrez Corea
On Tue, Aug 2, 2022 at 3:16 AM Christian Walde wrote: > On Tue, 02 Aug 2022 10:41:36 +0200, Ruprecht Helms (privat) < > rhe...@rheynmail.de> wrote: > > Am 02.08.22 um 10:07 schrieb Christian Walde: > >> On Mon, 01 Aug 2022 22:50:21 +0200, William Torrez Corea > >> wrote: > >> > >>> On Mon, Aug 1

Re: How to can develop a program

2022-08-02 Thread Ruprecht Helms (privat)
Hi everybody, Am 02.08.22 um 11:16 schrieb Christian Walde: On Tue, 02 Aug 2022 10:41:36 +0200, Ruprecht Helms (privat) wrote: Am 02.08.22 um 10:07 schrieb Christian Walde: What you're describing is how to make a roadmap for the implementation of a specific program. William asked about l

Re: How to can develop a program

2022-08-02 Thread Christian Walde
On Tue, 02 Aug 2022 10:41:36 +0200, Ruprecht Helms (privat) wrote: Am 02.08.22 um 10:07 schrieb Christian Walde: On Mon, 01 Aug 2022 22:50:21 +0200, William Torrez Corea wrote: On Mon, Aug 1, 2022 at 8:16 AM Christian Walde wrote: On Sat, 23 Jul 2022 21:03:18 +0200, William Torrez Corea

Re: How to can develop a program

2022-08-02 Thread Ruprecht Helms (privat)
for bigger developing-project the best thing is a roadmap, because you have to plan the steps what the thing should do. Start with a sheet of paper and a pencil and after that you can decide what programminglanguage to use and which module you want to start first. Regards, Ruprecht A

Re: How to can develop a program

2022-08-02 Thread Christian Walde
On Mon, 01 Aug 2022 22:50:21 +0200, William Torrez Corea wrote: On Mon, Aug 1, 2022 at 8:16 AM Christian Walde wrote: On Sat, 23 Jul 2022 21:03:18 +0200, William Torrez Corea < willitc9...@gmail.com> wrote: My goal: I want to create you should start [...] reading Modern Perl and Ovid's

Re: How to can develop a program

2022-08-01 Thread Shlomi Fish
Hi William! On Mon, 1 Aug 2022 14:50:21 -0600 William Torrez Corea wrote: > On Mon, Aug 1, 2022 at 8:16 AM Christian Walde > wrote: > > > On Sat, 23 Jul 2022 21:03:18 +0200, William Torrez Corea < > > willitc9...@gmail.com> wrote: > > > > My goal: I want to create > > > > > > Being that yo

Re: How to can develop a program

2022-08-01 Thread William Torrez Corea
On Mon, Aug 1, 2022 at 8:16 AM Christian Walde wrote: > On Sat, 23 Jul 2022 21:03:18 +0200, William Torrez Corea < > willitc9...@gmail.com> wrote: > > My goal: I want to create > > > Being that you barely know anything about Perl, you should start with > learning how Perl works by reading Modern

Re: How to can develop a program

2022-08-01 Thread Christian Walde
On Sat, 23 Jul 2022 21:03:18 +0200, William Torrez Corea wrote: My goal: I want to create Being that you barely know anything about Perl, you should start with learning how Perl works by reading Modern Perl and Ovid's Beginning Perl. Right now you're doing the moral equivalent of asking ho

Re: How to can develop a program

2022-08-01 Thread Ruprecht Helms (privat)
Hi, I know eclipse as a developingtool that is normaly used for Java-development. But this tool also have plugins for developing in PHP, for Android-Programming and maybe for development in perl or in python. Regards, Ruprecht Am 01.08.22 um 13:23 schrieb hw: I have installed eclipse on my

Re: How to can develop a program

2022-08-01 Thread hw
On Sun, 2022-07-31 at 21:06 -0600, William Torrez Corea wrote: > On Sun, Jul 31, 2022 at 8:55 PM hw wrote: > > > On Sun, 2022-07-31 at 18:04 -0600, William Torrez Corea wrote: > > > On Sun, Jul 31, 2022 at 5:57 PM Marco Shaw > > > wrote: > > > > > > > Being a novice, you have to realize there a

Re: How to can develop a program

2022-07-31 Thread William Torrez Corea
On Sun, Jul 31, 2022 at 8:55 PM hw wrote: > On Sun, 2022-07-31 at 18:04 -0600, William Torrez Corea wrote: > > On Sun, Jul 31, 2022 at 5:57 PM Marco Shaw > > wrote: > > > > > Being a novice, you have to realize there are certain limitations > > > to > > > things. In other words, Perl maybe can'

Re: How to can develop a program

2022-07-31 Thread hw
On Sun, 2022-07-31 at 18:04 -0600, William Torrez Corea wrote: > On Sun, Jul 31, 2022 at 5:57 PM Marco Shaw > wrote: > > > Being a novice, you have to realize there are certain limitations > > to > > things.  In other words, Perl maybe can't do EVERYTHING you want it > > to. > > > > Very clear,

Re: How to can develop a program

2022-07-31 Thread William Torrez Corea
On Sun, Jul 31, 2022 at 5:57 PM Marco Shaw wrote: > Being a novice, you have to realize there are certain limitations to > things. In other words, Perl maybe can't do EVERYTHING you want it to. > Very clear, so, would I use another language of programming to make the rest of the program?. --

Re: How to can develop a program

2022-07-31 Thread hw
On Sun, 2022-07-31 at 17:34 -0600, William Torrez Corea wrote: > Where can I start? > > I am Script kiddie, I have zero knowledge about Perl. I need a > stimulus. > > For example: I am executing perl examples. > > But the project i don't know how to start. > > https://learn.perl.org/ Always us

Re: How to can develop a program

2022-07-31 Thread Marco Shaw
I didn't try to read and fully absorb what you've been saying. I see mention of PDFs... So if you're trying to work with PDF files, the first thing you can do is Google "Perl PDF extract information". If that comes up empty, or points you to external tools like an external module or command to h

Re: How to can develop a program

2022-07-31 Thread William Torrez Corea
Where can I start? I am Script kiddie, I have zero knowledge about Perl. I need a stimulus. For example: I am executing perl examples. But the project i don't know how to start. https://learn.perl.org/

Re: How to can develop a program

2022-07-30 Thread hw
Well, what can you do with your bare hands? Build tools so you can do stuff, starting with using stones and the like for tools? On Fri, 2022-07-29 at 13:26 -0600, William Torrez Corea wrote: > On Fri, Jul 29, 2022 at 11:38 AM hw wrote: > > > On Sat, 2022-07-23 at 13:03 -0600, William Torrez

Re: How to can develop a program

2022-07-29 Thread William Torrez Corea
On Fri, Jul 29, 2022 at 11:38 AM hw wrote: > On Sat, 2022-07-23 at 13:03 -0600, William Torrez Corea wrote: > > My goal: I want to create something similar to the phone guide. In > > this > > page exist a great number of documents in format pdf. So, I want to > > unite > > the different documents

Re: How to can develop a program

2022-07-29 Thread hw
On Sat, 2022-07-23 at 13:03 -0600, William Torrez Corea wrote: > My goal: I want to create something similar to the phone guide. In > this > page exist a great number of documents in format pdf. So, I want to > unite > the different documents and can filter for name, last name, location. > If I > m

Re: How to can develop a program

2022-07-23 Thread William Torrez Corea
My goal: I want to create something similar to the phone guide. In this page exist a great number of documents in format pdf. So, I want to unite the different documents and can filter for name, last name, location. If I make this manually I have to open each document, download the document and sea

Re: How to can develop a program

2022-07-20 Thread Mike
I'm going to be traveling, so will not be able to help much in the next 2 days. That is a PDF file you supplied.  Is it fair to say you want to be able to search for all the names listed in a text file and be able to print out which file contains which name.  And in some cases the name will not

Re: How to can develop a program that search in different document in the network the name of a person?

2022-07-20 Thread William Torrez Corea
The url of the page: https://www.pgr.gob.ni/PDF/2021/GACETA/GACETA_17_08_2021.pdf On 7/20/22, William Torrez Corea wrote: > Exist a page where you put info about the person but if you want to search > a name you must search this manually. So, I want to automate this process > with perl. > -- > >

Re: How to remove BerkleyDB dependency when building Perl from sources

2020-01-28 Thread Shlomi Fish
Hi Jeffrey, On Tue, 28 Jan 2020 01:02:46 -0500 Jeffrey Walton wrote: > Hi Everyone, > > I regression test on old machines. The older machines need an updated > Git, SSH and Wget. To update Git, SSH and Wget I need to build a lot > of dependent software. Perl is one of them. > > On Fedora 1 whi

Re: How to remove BerkleyDB dependency when building Perl from sources

2020-01-28 Thread Jeffrey Walton
On Tue, Jan 28, 2020 at 3:02 AM Shlomi Fish wrote: > > ... > > > > On Fedora 1 while trying to build Perl 5.10.1: > > > > perl 5.10.1 is very old and no longer maintained (see what I wrote at > https://github.com/shlomif/supporting-older-perl5-releases ), but OTOH so is > Fedora 1. Yeah, this is

Re: how to catch die in a module

2019-08-08 Thread Shlomi Fish
Hi, On Thu, 8 Aug 2019 08:21:24 +0530 Chankey Pathak wrote: > You can create a signal handler for die and handle the exception in there. > Refer https://users.cs.cf.ac.uk/Dave.Marshall/PERL/node116.html > Also see block eval - https://perldoc.pl/functions/eval - or one of its wrappers like htt

Re: how to catch die in a module

2019-08-07 Thread Eliza
Hi all, Try::Tiny seems work fine to me. thanks. 在 2019/8/8 14:19, Shlomi Fish 写道: You can create a signal handler for die and handle the exception in there. Referhttps://users.cs.cf.ac.uk/Dave.Marshall/PERL/node116.html Also see block eval -https://perldoc.pl/functions/eval - or one of its

Re: how to catch die in a module

2019-08-07 Thread Andrew Solomon
Hi Eliza, For a simpler approach without "action at a distance" wrap the call which might trigger the die in an eval. For example: https://gist.github.com/andrewsolomon/e43522deebd71c6539ed12026f82788b Once you feel comfortable with this you can explore various libraries for handling this in a m

Re: how to catch die in a module

2019-08-07 Thread Chankey Pathak
You can create a signal handler for die and handle the exception in there. Refer https://users.cs.cf.ac.uk/Dave.Marshall/PERL/node116.html On Thu, 8 Aug, 2019, 8:15 AM Eliza, wrote: > Hello, > > I use such a module from other people. > In this module there is the "die" statement, for example, >

Re: How to test for existence of file with non-ascii characters

2018-12-26 Thread Uri Guttman
On 12/26/18 7:31 AM, Mike Martin wrote: Any ideas how to test for the existance of a file, when the file name contains extended ascii characters For example if the file contains emdash (U-2014) file -e always returns false -e should not be looking at the filename directly. it checks if th

Re: How to test for existence of file with non-ascii characters

2018-12-26 Thread Jesús Ruiz
I created a file whose name is just an emdash in bash with $ printf '\xe2\x80\x94' and this seems to work here (linux): my $fname = "\xe2\x80\x94"; if (-e "$fname") { print "exists\n" } On 2018-12-26 12:31:24, Mike Martin wrote: > Any ideas how to test for the existance of a file, when the

Re: How to compare timestamp in two different files(regex)

2018-10-25 Thread armando perez pena
Dear All, This is a Perl place for Python there are many places. BR, Armando El 25/10/18 a las 17:17, Chris Fedde escribió: why post a python solution here? On Thu, Oct 25, 2018 at 8:58 AM Asad mailto:asad.hasan2...@gmail.com>> wrote: Hi , Yes i have the code : import re import datetime fr

Re: How to compare timestamp in two different files(regex)

2018-10-25 Thread Chris Fedde
why post a python solution here? On Thu, Oct 25, 2018 at 8:58 AM Asad wrote: > Hi , > > Yes i have the code : > > import re > import datetime > from datetime import timedelta > > Header = "*" > > f3 = open ( r"D:\QI\logA.txt", 'r' ) > string =

Re: How to compare timestamp in two different files(regex)

2018-10-25 Thread Asad
Hi , Yes i have the code : import re import datetime from datetime import timedelta Header = "*" f3 = open ( r"D:\QI\logA.txt", 'r' ) string = f3.read () regex = re.compile ( "\n" ) st = regex.sub ( " ", string ) st1 = st.split ( " " ) if re.

Re: How to compare timestamp in two different files(regex)

2018-10-25 Thread Jim Gibson
(Please reply to the list.) If you have written code that extracts the date and time from the ‘LOG flle opened’ lines in the log file, then please show us your code. You seem to be asking other people to write your program for you. You will get better help if you appear to be making an effort t

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Jim Gibson
> On Oct 24, 2018, at 9:54 PM, Asad wrote: > > Thank all now I am able to progress : > > file1 i am able to extract the start and end timestamp > file 2 i am able to extract the timestamp > > used the following > my $t1 = Time::Piece->strptime('Feb 23 01:10:28 2018', '%b %d %H:%M:%S %Y'

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Asad
Thank all now I am able to progress : file1 i am able to extract the start and end timestamp file 2 i am able to extract the timestamp used the following my $t1 = Time::Piece->strptime('Feb 23 01:10:28 2018', '%b %d %H:%M:%S %Y'); coming from file1 my $t2 = Time::Piece->strptime('02/23/18 01:

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Martin McCormick
Someone brought to my attention that I had failed to define a couple of variables in the sample code I posted and they were quite right. I don't mind sharing my work but the entire application I wrote to get a brief local weather summary is 242 lines and I was trying to stay close to the topic, he

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Andy Bach
===> I am using the following regex : ([A-Z][a-z]{2}\s)([0-9]{2}\s[0-2][0-9](:[0-5][0-9]){2}\s[0-9]{4}) > Both are working as expected I would like to know if these are good regex or it can be better , please suggest . Concurring with the others, your setting yourself up for trouble with the RE

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Chris Fedde
I cannot emphasize enough how fragile the perhaps obvious regex based comparisons of timestamps can be. I second the approach demonstrated by Илья Рассадин above. There are subtle and difficult to debug problems buried in timestamps. Not least of which is locale ambiguity, discontinuities like da

Re: How to compare timestamp in two different files(regex)

2018-10-23 Thread Olivier
Hi, > Thank you all for the reply it is working for me . > > 1) for 02/23/18 01:10:33 ==> I am using the following regex > \d\d/\d\d/\d\d\s[012][0-9]:[0-5][0-9]:[0-5][0-9] > 2) Feb 23 01:10:28 2018 > > I am using the following regex : > ([A-Z][a-z]{2}\s)([0-9]{2}\s[0-2][0-9](:[0-5][0-9]){2}\

Re: How to compare timestamp in two different files(regex)

2018-10-23 Thread Asad
Thank you all for the reply it is working for me . 1) for 02/23/18 01:10:33 ==> I am using the following regex \d\d/\d\d/\d\d\s[012][0-9]:[0-5][0-9]:[0-5][0-9] 2) Feb 23 01:10:28 2018 > I am using the following regex : ([A-Z][a-z]{2}\s)([0-9]{2}\s[0-2][0-9](:[0-5][0-9]){2}\s[0-9]{4})

Re: How to compare timestamp in two different files(regex)

2018-10-23 Thread Andy Bach
> first hurdle is how do I extract this Feb 23 01:10:28 2018 from file1 which regex Look at perldoc -f stat ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) = stat($filename); Not all fi

Re: How to compare timestamp in two different files(regex)

2018-10-22 Thread Asad
Hi All , first hurdle is how do I extract this Feb 23 01:10:28 2018 from file1 which regex can I use ? convert it into epoch then regex for 02/23/18 01:10:33 is required ? convert into epoch So if you can suggest the correct regex for both t

Re: How to compare timestamp in two different files

2018-10-22 Thread Илья Рассадин
use Time::Piece; my $t1 = Time::Piece->strptime('Feb 23 01:10:28 2018', '%b %d %H:%M:%S %Y'); my $t2 = Time::Piece->strptime('02/23/18 01:10:33', '%m/%d/%y %H:%M:%S'); if ($t1 > $t2) { ... } On 23/10/2018 09:17, Asad wrote: Hi All ,         first hurdle is how do I extract this Feb 23 01:10:

RE: How to compare timestamp in two different files

2018-10-22 Thread Duncan Ferguson
/wiki/FAQ https://metacpan.org/pod/DateTime::Format::Strptime#$strptime-%3Eparse_datetime($string) The parsing section on https://perlmaven.com/datetime Duncs From: Asad [mailto:asad.hasan2...@gmail.com] Sent: 23 October 2018 07:18 To: Jim Gibson Cc: beginners@perl.org Subject: Re: How to compare

Re: How to compare timestamp in two different files

2018-10-22 Thread Asad
Hi All , first hurdle is how do I extract this Feb 23 01:10:28 2018 from file1 which regex can I use ? convert it into epoch then regex for 02/23/18 01:10:33 is required ? convert into epoch So if you can suggest the correct regex for both t

Re: How to compare timestamp in two different files

2018-10-22 Thread Asad
Thanks, I will do that. It was for perl . On Tue, Oct 23, 2018 at 10:42 AM Jim Gibson wrote: > On Oct 22, 2018, at 9:12 PM, Asad wrote: > > > > file1 : > > Patching tool version 12.1.0.2.0 Production on Fri Feb 23 01:10:28 2018 > > > > Bootstrapping registry and package to current versions...do

Re: How to compare timestamp in two different files

2018-10-22 Thread Jim Gibson
On Oct 22, 2018, at 9:12 PM, Asad wrote: > > file1 : > Patching tool version 12.1.0.2.0 Production on Fri Feb 23 01:10:28 2018 > > Bootstrapping registry and package to current versions...done > statement ERR-2001: table is corrupt check for cause > > could not determine the current status. >

Re: How to use Text::Wrap correctly

2017-08-23 Thread Chris Fedde
I have a utility I use to wrap logging lines and make them easier to look at. It has different features than you want but down in the core might be a few clues of some use. Without options it generates output like the below: $ wrap /var/log/mail.log Aug 23 10:39:52 crf postfix/pickup[12668]:

Re: How to use Text::Wrap correctly

2017-08-22 Thread Harry Putnam
rea...@newsguy.com (Harry Putnam) writes: > So trying to simplify things I'm running the script against 3 log > lines produced by sendmail. The 3 lines below are in a file named > `mail-loglines'. Instead of simplifying I made a mess of things... I left this line at the bottom of the script: __

Re: How to use Text::Wrap correctly

2017-08-22 Thread Harry Putnam
jimsgib...@gmail.com (Jim Gibson) writes: > There is an error in what I posted (sorry). The input is read into > the $line variable, but your regular expression is implicitly > testing the default variable $_. The loop should be: > > > while ( my $line = <> ) { > if ( $line =~ /$rgx/ ) { >

Re: How to use Text::Wrap correctly

2017-08-19 Thread Jim Gibson
> On Aug 18, 2017, at 6:05 AM, Harry Putnam wrote: > > jimsgib...@gmail.com (Jim Gibson) writes: >>> > > A second attempt trying to use your last example as inspiration > follows: > > ---8< snip -8< snip -- > > use strict; > use warnings; > use Text::Wrap; > >

Re: How to use Text::Wrap correctly

2017-08-18 Thread Harry Putnam
jimsgib...@gmail.com (Jim Gibson) writes: >> On Aug 13, 2017, at 6:02 PM, Harry Putnam wrote: >> >> My aim: >> >> Run certain kinds of log file lines thru a perl script that will: >> >> 1) Identify each line by regex that finds pattern at start of line >> 2) When such a line is found, print ne

Re: How to use Text::Wrap correctly

2017-08-17 Thread Harry Putnam
jimsgib...@gmail.com (Jim Gibson) writes: >> On Aug 13, 2017, at 6:02 PM, Harry Putnam wrote: >> >> My aim: >> [...] >> my @text; >> >> while (<>) { >> if (/$rgx/) { >> print "\n"; >> print wrap(",", @text); >> } >> } >> >> It wasn't at all clear from perldoc Text::Wrap how @text is sup

Re: How to use Text::Wrap correctly

2017-08-13 Thread Jim Gibson
> On Aug 13, 2017, at 6:02 PM, Harry Putnam wrote: > > My aim: > > Run certain kinds of log file lines thru a perl script that will: > > 1) Identify each line by regex that finds pattern at start of line > 2) When such a line is found, print newline first then > 3) wrap any lines longer than s

Re: How to match words with a consecutive character

2017-05-06 Thread David Emanuel da Costa Santiago
Thanks! I didn't knew that feature. It's very cool! Thank you very much. Best regards, David Santiago On Sat, 6 May 2017 23:03:48 +0100 David Precious wrote: > On Sat, 6 May 2017 23:13:04 +0200 > David Emanuel da Costa Santiago wrote: > > Is there any regular expression, that can match an

Re: How to match words with a consecutive character

2017-05-06 Thread David Precious
On Sat, 6 May 2017 23:13:04 +0200 David Emanuel da Costa Santiago wrote: > Is there any regular expression, that can match any consecutive > character? You want to use a back-reference - e.g. /(.)\1+/ matches any character followed by one or more of that same character. Demo: [davidp@cloudburst

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-20 Thread lee
Shekar writes: > Depending upon how vendor implemented SNMP part for their device, other > than standard OID's such as sysUptime , will have custom MIB files. > You should try visiting their website for downloading required MIB file for > your switch. > Then import them with -m or put it under sn

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-20 Thread lee
mailing lists writes: > are you sure? > > # emerge -s expect >     > [ Results for search key : expect ] > Searching... > > [...] > *  dev-perl/Expect >   Latest version available:

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-19 Thread Shekar
Depending upon how vendor implemented SNMP part for their device, other than standard OID's such as sysUptime , will have custom MIB files. You should try visiting their website for downloading required MIB file for your switch. Then import them with -m or put it under snmp path to get its OID's wo

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-19 Thread lee
lee writes: > Shekar writes: > >> +1 for SNMP, or if Net::SSH::Perl didn't help, can you try expect module? > > Thanks! 'Expect' isn't available as Gentoo package, so I skipped it. > > SNMP is probably better, so I need to learn about that first and see if > I can use it. I guess it's time to

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-19 Thread lee
Shekar writes: > +1 for SNMP, or if Net::SSH::Perl didn't help, can you try expect module? Thanks! 'Expect' isn't available as Gentoo package, so I skipped it. SNMP is probably better, so I need to learn about that first and see if I can use it. I guess it's time to learn about SNMP anyway :

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-19 Thread Shekar
+1 for SNMP, or if Net::SSH::Perl didn't help, can you try expect module? Cheers, Shekar On Wed, Apr 19, 2017 at 1:38 PM, lee wrote: > Duncan Ferguson writes: > > > If the temperature is available on your switch, can you not enable SNMP > on it and read the specific OID to get the info? Far

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-19 Thread lee
Duncan Ferguson writes: > If the temperature is available on your switch, can you not enable SNMP on it > and read the specific OID to get the info? Far far easier than trying to > keep an ssh connection open, I think. > > I guess this does depend on the switch type and whether the info is ava

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-19 Thread lee
SSC_perl writes: >> On Apr 18, 2017, at 6:19 PM, lee wrote: >> >> The purpose is to get room temperature readings > > Hey Lee, > > I don’t have a solution for you, but I have an idea that might > help. Have you tried the Misterhouse mailing list? It’s a Perl > script that handles sensor

RE: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-19 Thread Duncan Ferguson
If the temperature is available on your switch, can you not enable SNMP on it and read the specific OID to get the info? Far far easier than trying to keep an ssh connection open, I think. I guess this does depend on the switch type and whether the info is available on the device via SNMP, tho

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-18 Thread X Dungeness
Hm, IIUC can't the remote script sleep-loop and send output back asynchronously. (More reseach needed on async piece).. $ssh->system('/path/to/remote_script arg, arg,...'); #!/bin/... # remote_script for (...); do get_temp_probe(); . ; sleep 300; done On Tue, Apr 18, 2017 at 6:19

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-18 Thread SSC_perl
> On Apr 18, 2017, at 6:19 PM, lee wrote: > > The purpose is to get room temperature readings Hey Lee, I don’t have a solution for you, but I have an idea that might help. Have you tried the Misterhouse mailing list? It’s a Perl script that handles sensors like that so someone there

Re: How to delete multiple indices from array

2017-04-12 Thread Илья Рассадин
Thanks for your reply. First of all, my example was not about performance, but was about an idea. So you are correct about qw and sort. I'm sorry if someone saw this example and decide to use it without reading perldoc and understanding what we do. We need to reverse sort because when we st

Re: How to delete multiple indices from array

2017-04-12 Thread Shawn H Corey
On Wed, 12 Apr 2017 19:34:22 -0400 Uri Guttman wrote: > it is so odd to be filtering an array by the indexes. i smell an XY > problem here. i wonder what the real goal is vs how to solve it this > way. > > thanx, > > uri I was thinking that too. -- Don't stop where the ink does. S

Re: How to delete multiple indices from array

2017-04-12 Thread Uri Guttman
On 04/12/2017 07:29 PM, Shawn H Corey wrote: On Wed, 12 Apr 2017 18:16:56 -0400 Uri Guttman wrote: It's not about saving time. It's about removing a bug. In the code below, notice that there are two different outputs depending on the order that splice is applied. It's only by using descending i

Re: How to delete multiple indices from array

2017-04-12 Thread Shawn H Corey
On Wed, 12 Apr 2017 18:16:56 -0400 Uri Guttman wrote: > On 04/12/2017 05:42 PM, Shawn H Corey wrote: > > On Wed, 12 Apr 2017 16:19:32 -0400 > > Uri Guttman wrote: > > > > > > my @array; > > > > for my $index (reverse sort @indices) { > >> sort defaults to a lexical sort which won't work well on

Re: How to delete multiple indices from array

2017-04-12 Thread Uri Guttman
On 04/12/2017 05:42 PM, Shawn H Corey wrote: On Wed, 12 Apr 2017 16:19:32 -0400 Uri Guttman wrote: my @array; for my $index (reverse sort @indices) { sort defaults to a lexical sort which won't work well on integers with more than 2 digits. and why are you sorting and reversing the indexes?

Re: How to delete multiple indices from array

2017-04-12 Thread X Dungeness
Quite! Even the slowest may find redemption in clarity :) my @arr = qw( zero one two three ... ); my @del = qw( 2,4,... ); my( %del, @new ); @del{ @del } = (); for (0..$#arr) { push @new, $arr[$_] unless exists $del{$_}} On Wed, Apr 12, 2017 at 2:18 PM, Paul Johnson wrote: > On Wed, Apr 12, 20

Re: How to delete multiple indices from array

2017-04-12 Thread Shawn H Corey
On Wed, 12 Apr 2017 16:19:32 -0400 Uri Guttman wrote: > On 04/12/2017 04:08 PM, Илья Рассадин wrote: > > Hi! > > > > You can use splice to delete elements from array. > > > > To delete multiple elements you need to do splice in a loop > > > > my @indices = qw/2 4 5 7/; > > why are you using qw w

Re: How to delete multiple indices from array

2017-04-12 Thread Paul Johnson
On Wed, Apr 12, 2017 at 11:12:45PM +0200, David Emanuel da Costa Santiago wrote: > Thank you all for your replies. > > I tested the 5 solutions with the benchmark module, and the splice one > is the fastest: > The hash one, which was my first solution is the slowest one. :-( But they're all fas

Re: How to delete multiple indices from array

2017-04-12 Thread David Emanuel da Costa Santiago
Thank you all for your replies. I tested the 5 solutions with the benchmark module, and the splice one is the fastest: Benchmark: timing 99 iterations of each, grep, hash, keep, splice... each: 5 wallclock secs ( 5.07 usr + 0.00 sys = 5.07 CPU) @ 197238.46/s (n=99) grep: 5 wallc

Re: How to delete multiple indices from array

2017-04-12 Thread Uri Guttman
On 04/12/2017 04:38 PM, Shlomi Fish wrote: Hi Uri! Some notes. On Wed, 12 Apr 2017 15:19:33 -0400 Uri Guttman wrote: On 04/12/2017 03:00 PM, David Emanuel da Costa Santiago wrote: Hello! What's the best way to delete multiple indices from an array? i'm doing: --- my @array=qw

Re: How to delete multiple indices from array

2017-04-12 Thread Shlomi Fish
Hi Uri! Some notes. On Wed, 12 Apr 2017 15:19:33 -0400 Uri Guttman wrote: > On 04/12/2017 03:00 PM, David Emanuel da Costa Santiago wrote: > > Hello! > > > > What's the best way to delete multiple indices from an array? > > > > i'm doing: > > > > --- > > my @array=qw/zero one two th

Re: How to delete multiple indices from array

2017-04-12 Thread Uri Guttman
On 04/12/2017 04:08 PM, Илья Рассадин wrote: Hi! You can use splice to delete elements from array. To delete multiple elements you need to do splice in a loop my @indices = qw/2 4 5 7/; why are you using qw which makes strings and not a list of integers? my @array; for my $index (reverse

Re: How to delete multiple indices from array

2017-04-12 Thread Илья Рассадин
Hi! You can use splice to delete elements from array. To delete multiple elements you need to do splice in a loop my @indices = qw/2 4 5 7/; my @array; for my $index (reverse sort @indices) { splice @array, $index, 0; } 12.04.17 22:19, Uri Guttman пишет: On 04/12/2017 03:00 PM, David

Re: How to delete multiple indices from array

2017-04-12 Thread Uri Guttman
On 04/12/2017 04:01 PM, David Emanuel da Costa Santiago wrote: Thanks for your reply. I didn't think about that! :-) While i was reading your email, i remembered about splice, so i guess i'm going to end up with: -- my @array=qw/zero one two three four five six seven eight nine ten/; m

Re: How to delete multiple indices from array

2017-04-12 Thread David Emanuel da Costa Santiago
Thanks for your reply. I didn't think about that! :-) While i was reading your email, i remembered about splice, so i guess i'm going to end up with: -- my @array=qw/zero one two three four five six seven eight nine ten/; my @indicesToDelete = (2,4,6,7); my $deviation = 0; splice(@arra

Re: How to delete multiple indices from array

2017-04-12 Thread Uri Guttman
On 04/12/2017 03:00 PM, David Emanuel da Costa Santiago wrote: Hello! What's the best way to delete multiple indices from an array? i'm doing: --- my @array=qw/zero one two three four five six seven eight nine ten/; my @indicesToDelete = (2,4,6,7); if you have the indexes to kee

Re: how to recursion

2017-03-29 Thread PYH
I asked this just b/c I want to do matrix calculation in perl. I found under some conditions a recursion is more effective. Thanks everybody. On 2017/3/29 23:31, Chas. Owens wrote: On Tue, Mar 28, 2017 at 9:27 PM PYH mailto:p...@vodafonemail.de>> wrote: Hi, what's the better way to wr

Re: how to recursion

2017-03-29 Thread Chas. Owens
On Tue, Mar 28, 2017 at 9:27 PM PYH wrote: > Hi, > > what's the better way to write a recursion in perl's class? > > sub my_recursion { > my $self = shift; > > if (...) { > $self->my_recursion; > } > } > > this one? > Define better. In general that is the right

  1   2   3   4   5   6   7   8   9   10   >