Re: how to can measure my level of knowledge?

2024-05-31 Thread Rob Coops
ge all you need to do is figure out how to do each step one at a time. You might not know how to list the contents of a directory in your language of choice (in this case Perl) but that is easy enough to look up. The same for finding the attributes associated with a file, again this is easy en

how to can measure my level of knowledge?

2024-05-30 Thread William Torrez Corea
I code but my logic is weak, i code 1000 lines of code but I don't understand the logic of the program. Can write 10 lines of code, get the result but I don't understand the concept. Can code the program but I can't interpret. My mentor told me: understand the concept because I talk nonsense. --

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
;hw" Sent: Friday, January 12, 2024 7:16am To: "Perl Beginners" Subject: How to reboot? Hi, I would like to write a program (daemon) which will be automatically started by systemd at boot which will allow me to reboot or restart my computer through commands sent via xmpp. The xm

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 >

How to reboot?

2024-01-12 Thread hw
Hi, I would like to write a program (daemon) which will be automatically started by systemd at boot which will allow me to reboot or restart my computer through commands sent via xmpp. The xmpp part (xmpp client) and starting that program is no problem. But how can I reboot/restart the computer

Re: How to can develop a program

2022-08-05 Thread hw
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 askin

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)
Beginning Perl.* *Right now you're doing the moral equivalent of asking how to draw Mona Lisa's eye when you don't even know which end of a paint brush paints.* A roadmap is like a guide but I am too following your advice. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.

Re: How to can develop a program

2022-08-02 Thread William Torrez Corea
?? > > > > > > > > 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 >

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

Re: How to can develop a program

2022-08-02 Thread Christian Walde
ave 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. What you're describing is how to make a roadmap for the implementation of a specific program. Wil

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
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 how t

Re: How to can develop a program

2022-08-01 Thread William Torrez Corea
w Perl works by reading Modern Perl and Ovid's Beginning Perl. > > Right now you're doing the moral equivalent of asking how to draw Mona > Lisa's eye when you don't even know which end of a paint brush paints. > > -- > With regards, > Christian Walde >

Re: How to can develop a program

2022-08-01 Thread Christian Walde
of asking how to draw Mona Lisa's eye when you don't even know which end of a paint brush paints. -- With regards, Christian Walde

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

Re: How to can develop a program

2022-07-31 Thread Marco Shaw
ipt 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-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. > -- > >

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
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. -- With kindest regards, William. ⢀⣴⠾⠻⢶⣦⠀ ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org ⠈⠳⣄

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

How to remove BerkleyDB dependency when building Perl from sources

2020-01-27 Thread Jeffrey Walton
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 while trying to build Perl 5.10.1: I've tried to compile and run the following simple p

Re: how to catch die in a module

2019-08-08 Thread Shlomi Fish
ere is the "die" statement, for example, > > > > connect(...) or die $!; > > > > Then my main program will die follow up this "die". > > But I don't want the caller to die even if "die" was happened in the > > module. > > How t

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
...) or die $!; >> >> Then my main program will die follow up this "die". >> But I don't want the caller to die even if "die" was happened in the >> module. >> How to handle with it? >> >> Thank you. >> Eliza >>

Re: how to catch die in a module

2019-08-07 Thread Chankey Pathak
statement, for example, > > connect(...) or die $!; > > Then my main program will die follow up this "die". > But I don't want the caller to die even if "die" was happened in the > module. > How to handle with it? > > Thank you. > Eliza >

how to catch die in a module

2019-08-07 Thread Eliza
Hello, I use such a module from other people. In this module there is the "die" statement, for example, connect(...) or die $!; Then my main program will die follow up this "die". But I don't want the caller to die even if "die" was happened in the module

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

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 ho

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

2018-12-26 Thread Mike Martin
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 thanks Mike

how to send a file via xmpp?

2018-11-23 Thread hw
Hi, how can I get my program to send a file via xmpp? Sending and receiving messages with Net::XMPP works fine, yet base64-encoding the files to send them as messages isn't really an option because there would be too many clients unable to decode them. -- To unsubscribe, e-mail: beginners

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

2018-10-25 Thread armando perez pena
ailto:jimsgib...@gmail.com>> wrote: (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 he

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

2018-10-25 Thread Chris Fedde
0-22 10:21:25 > Install patch2 - correct solution * > > > > > > On Thu, Oct 25, 2018 at 6:56 PM Jim Gibson wrote: > >> (Please reply to the list.) >> >> If you have written code that extracts the date and time from the ‘LOG >> flle opened’ lines in th

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

2018-10-25 Thread Asad
On Thu, Oct 25, 2018 at 6:56 PM Jim Gibson wrote: > (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

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

2018-10-25 Thread Jim Gibson
to solve these problems yourself. Anyone wishing to get help from a forum such as beginners@perl.org would do well to read this website on how to ask smart questions: <http://www.catb.org/~esr/faqs/smart-questions.html> Now, to address your problem: If you have a starting time and an

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

How to compare timestamp in two different files

2018-10-22 Thread Asad
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. file2 : LOG file opened at 02/03/18 01:11:05 DUP-05004:

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
ine >> 2) When such a line is found, print newline first then >> 3) wrap any lines longer than specified number of columns. >> >> >> I was not able to divine from `perldoc Text::Wrap' how to really use >> it to do what I want. >> >> my non-w

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
wrap any lines longer than specified number of columns. > > > I was not able to divine from `perldoc Text::Wrap' how to really use > it to do what I want. > > my non-working effort stripped to the bare bones: > > use strict; > use warnings; > use Text::Wrap;

How to use Text::Wrap correctly

2017-08-13 Thread Harry Putnam
Text::Wrap' how to really use it to do what I want. my non-working effort stripped to the bare bones: use strict; use warnings; use Text::Wrap; my $rgx = qr/@{[shift]}/; $Text::Wrap::columns = 68; my @text; while (<>) { if (/$rgx/) { print "\n"; print wrap(&

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

How to match words with a consecutive character

2017-05-06 Thread David Emanuel da Costa Santiago
Hello. Is there any regular expression, that can match any consecutive character? Example: qwerty -> no match qwertyq -> no match qqwerty -> match because of the qq qwerrrty -> match because of the rrr and so on... My obvious attempts that resulted in failure were: 1- /.{2,}/ 2- /[qwerty]{2,

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
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 :) > > Ok, I got this far: > > > snmpget -v 3 -u lee h3c .1.3.6.1.2.1.1.3.

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
nd see if > I can use it. I guess it's time to learn about SNMP anyway :) Ok, I got this far: snmpget -v 3 -u lee h3c .1.3.6.1.2.1.1.3.0 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1081149678) 125 days, 3:11:36.78 Any idea how to get the temperature reading? -- To unsubscribe, e

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
, though. Duncs -Original Message- From: lee [mailto:l...@yagibdah.de] Sent: 19 April 2017 02:20 To: beginners@perl.org Subject: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output? Hi, I'm trying to repeatedly ex

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

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 lee
Hi, I'm trying to repeatedly execute a command on a remote machine and to capture the output with a perl program. I have tried Net::OpenSSH and Net::SSH::Perl. Both log in, execute the command, capture the output --- and then log out. According to the log file of the remote machine, Net::OpenS

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'

Re: How to delete multiple indices from array

2017-04-12 Thread Uri Guttman
iginal array of data). 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 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h..

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

  1   2   3   4   5   6   7   8   9   10   >