Re: Subroutine return value

2025-05-14 Thread Jim Gibson via beginners
Put this line as the last line executed in your subroutine: return $sum; That makes it explicit as to what you want the subroutine to do. Don’t depend upon some obscure behavior of Perl to save a few keystrokes. Your program will be better for it. > On May 14, 2025, at 4:15 PM, Daryl

Re: Regex To get the Job Number and Corresponding state

2025-02-25 Thread Asad
Thanks a lot. On Wed, 26 Feb 2025 at 8:55 AM, Jim Gibson wrote: > If you are reading a file with normal line endings (e.g., “\n”), then you > want to parse each line as “key: value” using a regular expression, save > the job id, current status and current phase values. When you have all > three

Re: Regex To get the Job Number and Corresponding state

2025-02-25 Thread Jim Gibson
If you are reading a file with normal line endings (e.g., “\n”), then you want to parse each line as “key: value” using a regular expression, save the job id, current status and current phase values. When you have all three, you can check the status and phase values for the values you are lookin

Re: Regex To get the Job Number and Corresponding state

2025-02-25 Thread Dermot
What is the record separator? How can we tell `Job ID: 52` from `Job ID: 51`? The input record separator is newline by default. If you want the Job ID of the records where status=SUCCEEDED, you'll need to set the record separator to something other than "\n" and do a multi-line search.`/m`. I thin

Re: Regex To get the Job Number and Corresponding state

2025-02-25 Thread Asad
The problem with grep is that line numbers may change so even if i do grep -E SUCCEEDED|"\ "ZDM_SETUP_TGT\"" -B5 , it may not alway 5 line above or is there a more better way in grep or regex On Tue, Feb 25, 2025 at 10:22 PM Erick Paquin wrote: > You can use grep for this.. > > --- > Erick Pa

Re: Regex To get the Job Number and Corresponding state

2025-02-25 Thread Erick Paquin via beginners
You can use grep for this.. --- Erick Paquin On 25/02/2025 11:49 am, Asad wrote: Hi All, I have a requirement to use regex , find the Job ID for the Current status: SUCCEEDED and Current Phase: "ZDM_SETUP_TGT" from a file which has data in the format gives below : Job ID: 52 User: zdmuser Cl

Re: Removing a space from file name

2025-02-19 Thread Smoot Carl-Mitchell via beginners
On Thu, 2025-02-20 at 08:01 +0800, walt via beginners wrote: > > > > Something like: > > > > while (<*>) { > > rename $_, "$1$2.jpg" if $_ =~ /(.+) (.+)\.jpg/; > > } > > > > what does <*> mean here? <*> iterates over the current directory and returns every filename in the directory to the

Re: Removing a space from file name

2025-02-19 Thread walt via beginners
On 2025-02-18 04:12, Smoot Carl-Mitchell via beginners wrote: On Mon, 2025-02-17 at 12:38 -0500, hput wrote: I have several hundred *.jpg files with this pattern Actual example:    'AtlantaVisitAndGrandmaHands 056.jpg' The numbers vary, of course, but the alpha part and number of digits after

Re: Removing a space from file name

2025-02-17 Thread Smoot Carl-Mitchell via beginners
the same in all *.jpg files > > I have hundreds of these all in one directory.  Not something you'd > want to do one at a time. Something like: while (<*>) { rename $_, "$1$2.jpg" if $_ =~ /(.+) (.+)\.jpg/; } The RE matches any filename with a single

Re: Removing a space from file name

2025-02-17 Thread Mike Hübschen via beginners
Hello, Try something like this: rename 's/(.*?)\s(\d+).jpg$/$1$2.jpg/' *.jpg But make a backup first. Best regards, Mike On 2/17/25 18:38, hput wrote: I have several hundred *.jpg files with this pattern Actual example: 'AtlantaVisitAndGrandmaHands 056.jpg' The numbers vary, of course

Re: Linux Directory Copy Modules that Won't

2025-02-01 Thread Martin McCormick
Many thanks to all 3 who replied. You've given me more things to try. For one brief shining moment, I thought the very first suggestion had fixed the problem but I neglected to put the "or die!;" clause at the end of the line and it's still the same silent failure. For now, I will use t

Re: Linux Directory Copy Modules that Won't

2025-02-01 Thread Jesus Lozano Mosterin
Hi there. Another nix way is to use ‘rsync’ with any —exclude you want To put in a .sh file plus cron is the lazy way of Life. Cheers. El El sáb, 1 feb 2025 a las 16:43, Ruprecht Helms (privat) < rhe...@rheynmail.de> escribió: > Hi, > > I do my backups to the nas by a short bash-script using th

Re: Linux Directory Copy Modules that Won't

2025-02-01 Thread Jim Gibson via beginners
> On Feb 1, 2025, at 6:34 AM, Martin McCormick wrote: > > This is perl 5, version 36, subversion 0 (v5.36.0) built for > x86_64-linux-gnu-thread-multi > (with 53 registered patches, see perl -V for more detail) > > Copyright 1987-2022, Larry Wall > > The issue here is trying to copy directo

Re: Linux Directory Copy Modules that Won't

2025-02-01 Thread Ruprecht Helms (privat)
Hi, I do my backups to the nas by a short bash-script using the wput-command. That is combined with a cronjob that does ist every hour. Its not the perl-way but a seamilar. Regards, Ruprecht On 01.02.25 15:34, Martin McCormick wrote: This is perl 5, version 36, subversion 0 (v5.36.0) built fo

Re: iterate over the use-d modules

2024-10-01 Thread Levi Nystad-Johansen via beginners
@INC contains all locations modules can be loaded from. %INC contains all modules that have been loaded. See https://perldoc.perl.org/perlvar#%INC say for keys %INC; -Levi Opprinnelig melding Den 01.10.2024 17:31, Andy Bach skrev: > Look at perldoc for "require" but I believ

Re: iterate over the use-d modules

2024-10-01 Thread Andy Bach
Look at perldoc for "require" but I believe what you want is @INC in place of your @used. Hmm, maybe not % perl -E 'use strict; say for ( @INC );' /Library/Perl/5.34/darwin-thread-multi-2level /Library/Perl/5.34 /Network/Library/Perl/5.34/darwin-thread-multi-2level /Network/Library/Perl/5.34 /Lib

Re: What is best way for learn programming?

2024-09-06 Thread Jeff Pang
On 2024-09-06 20:16, Maxim Abalenkov wrote: Learning Perl (https://www.oreilly.com/library/view/learning-perl-8th/9781492094944), Intermediate Perl (https://www.oreilly.com/library/view/intermediate-perl-2nd/9781449343781) and Mastering Perl (https://www.oreilly.com/library/view/mastering

Re: Can use Perl and C in a program?

2024-08-05 Thread Manikandan
Hi William, Simply use exec or system command to call a program from other language, but make sure you get control from that program back to your Perl code. warm regards On Fri, Jul 26, 2024 at 10:41 PM William Torrez Corea wrote: > How can I implement these two languages of programming in a pro

Re: What is best way for learn programming?

2024-08-04 Thread Jeff Pang via beginners
On 2024-08-04 22:05, Pranshu wrote: I reccomend using an advanced book, one that you might not evne fully understand. This way you can keep engagement through the difficulty of the book, and also learn complex concepts faster. A classic "advanced" perl book is 'Higher Order Perl'. Isn’t the b

Re: What is best way for learn programming?

2024-08-04 Thread karl
William Torrez Corea: ... > I enjoy programming but I feel like a novice continuing over time. My > colleague learns and applies the learning, I learn but I don't apply the > learning. So what is your preffered way to learn things ? >From what I heard, there are three ways to learn: 1, from what

Re: What is best way for learn programming?

2024-08-04 Thread Pranshu
I reccomend using an advanced book, one that you might not evne fully understand. This way you can keep engagement through the difficulty of the book, and also learn complex concepts faster. A classic "advanced" perl book is 'Higher Order Perl'. -- To unsubscribe, e-mail: beginners-unsubscr..

Re: What is best way for learn programming?

2024-07-31 Thread karl
William Torrez Corea: >1. Course >2. Books >3. Documentation >4. Projects > > I was learning programming with a book but I quickly lost interest. My > progress is slow. If you loose interest, then think about why you did you try, do you really want to learn a programming language

Re: What is best way for learn programming?

2024-07-31 Thread Olivier
Jeff Pang via beginners writes: > I was leaning perl from the library of Spamassassin. :) That's a though one, SA is not the easiest piece of code! Olivier > > On 2024-08-01 09:37, i...@erickpaquin.com wrote: >> Best way like Olivier said is to do an actual real project or script >> that you

Re: What is best way for learn programming?

2024-07-31 Thread Jeff Pang via beginners
I was leaning perl from the library of Spamassassin. :) On 2024-08-01 09:37, i...@erickpaquin.com wrote: Best way like Olivier said is to do an actual real project or script that you (or someone else) will be using. Exercises in books never cover real life challenges fully or all the differen

Re: What is best way for learn programming?

2024-07-31 Thread info
Best way like Olivier said is to do an actual real project or script that you (or someone else) will be using. Exercises in books never cover real life challenges fully or all the different aspects and interactions that you'll face. Contributing to other projects is also another one... Erick

Re: What is best way for learn programming?

2024-07-31 Thread Olivier
William Torrez Corea writes: > 1 Course > 2 Books > 3 Documentation > 4 Projects My prefered way is to learn when I have an actual need. So until I have a programming project, I will not waste time to learne a new language. Olivier > > I was learning programming with a book but I quickly lost

Re: Can use Perl and C in a program?

2024-07-27 Thread karl
William Torrez Corea: > How can I implement these two languages of programming in a program? ... If you use `cmd`, system() etc. in perl, you are in fact calling another program that might be written in some other language. The same is true, using fork() exec() system() etc. in c, you could r

Re: Can use Perl and C in a program?

2024-07-26 Thread Jeff Pang via beginners
On 2024-07-27 01:11, William Torrez Corea wrote: How can I implement these two languages of programming in a program? You want to check the following library. https://metacpan.org/dist/Inline-C/view/lib/Inline/C.pod -- regards, Jeff Pang -- To unsubscribe, e-mail: beginners-unsubscr...@perl.

Re: First line of input file not accessible.

2024-07-17 Thread David Precious
On Wed, 17 Jul 2024 17:41:22 +1000 Peter West via beginners wrote: [...] > $ cat print_file > #!/usr/bin/perl -n > while (<>) { > print "$. $_"; > } > exit; [...] > What happened to line 1? It's eaten by the `while (<>) { ... }` loop that is wrapped around your program because you used `-n` i

Re: algorithms

2024-06-28 Thread karl
William Torrez Corea: > What is the difference between computer algorithms, pseudocode and source > code? I think this explains that: https://en.wikipedia.org/wiki/Algorithm https://en.wikipedia.org/wiki/Pseudo_code https://en.wikipedia.org/wiki/Source_code Regards, /Karl Hammar -- To unsubsc

Re: regex matching statements

2024-06-18 Thread Levi Elias Nystad-Johansen via beginners
Hi, Yes, they are the same. I like to use $_ only when the data comes in $_ naturally. Like in a for loop: for (qw< abc >) { if ( !/\w+\d+/ ) { print "not matched"; } } Otherwise, I have to write $_, then I prefer to name the variable something descriptive instead. Makes the code

Re: Easiest Way in Perl to check Whether a Disk is Mounted

2024-06-05 Thread Jesús Lozano Mosterín
El 5/6/24 a las 22:28, Mike escribió: I sure couldn't figure out how to test for a mount with that module.  And I did go to 'man 2 mount'. Still couldn't figure it out. Mike On 6/1/24 18:29, Jeff P via beginners wrote: Of course, I can use system calls and call the unix mount or mount

Re: Easiest Way in Perl to check Whether a Disk is Mounted

2024-06-05 Thread karl
You can check if something is mounted by comparing which device a specific directory is on and comparing it to its parent directory. $ cat chk_mount.pl #!/usr/bin/perl -w use strict; use Fcntl ':mode'; my $A = $ARGV[0] // "/"; my $B = $ARGV[1] // "/var"; my @Ast = stat $A; my @Bst = stat $B;

Re: Easiest Way in Perl to check Whether a Disk is Mounted

2024-06-05 Thread Will Mengarini via beginners
* Martin McCormick [24-06/01=Sa 09:25 -0500]: > [...] determine whether a file system is mounted such as > $ mount |grep horseradish > [...] I think perl -e 'print grep m[/horseradish],`mount`' is hard to beat for its simplicity. Note I'm using Perl's built-in grep; there's no need to run the

Re: Easiest Way in Perl to check Whether a Disk is Mounted

2024-06-05 Thread Mike
I sure couldn't figure out how to test for a mount with that module.  And I did go to 'man 2 mount'. Still couldn't figure it out. Mike On 6/1/24 18:29, Jeff P via beginners wrote: Of course, I can use system calls and call the unix mount or mountpoint applications but is there a proper

Re: Easiest Way in Perl to check Whether a Disk is Mounted

2024-06-01 Thread Jeff P via beginners
Of course, I can use system calls and call the unix mount or mountpoint applications but is there a proper perl way to do this since system calls are not as elegant? Thank you. How about this module from metacpan? https://metacpan.org/pod/Sys::Linux::Mount regards. -- To unsubscribe, e-m

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: crypt

2024-05-25 Thread Zheng Li Sheng
Hi, Maybe not being compiled with libcrypt ? What is the output of "perl -V | grep --color -i crypt" and "ldd /home/masayoshi/localperl/bin/perl" ? Regards, On Sat, May 25, 2024 at 4:00 PM Masayoshi Fujimoto wrote: > Hi. > OpenBSD does not work crypt. > Does it depends on OSes ? > Do you know

Re: project

2024-05-18 Thread karl
William: > What is the need to develop a project in Perl? Perl and some knowledge of what the project is about. You can, at your own convenience or requirement, add some version control system, some editor or progremming environment, etc. Regards, /Karl Hammar -- To unsubscribe, e-mail: begi

Re: module dependency

2024-05-16 Thread sisyphus
At the command prompt, run: perl -le 'use Net::SMTPS; print for keys %INC;' That will tell you the names of all of the modules that get loaded when you load Net::SMTP. Cheers, Rob On Thu, May 16, 2024 at 11:07 PM Netwinds wrote: > greetings everybody, > > How do I know which other modules are

Re: module dependency

2024-05-16 Thread karl
Netwinds: > How do I know which other modules are required by the perl module > (like Net::SMTPS) I am using? You mean like go to cpan: https://metacpan.org/pod/Net::SMTPS and looking at the left column under dependencies ? Regards, /Karl Hammar -- To unsubscribe, e-mail: beginners-unsubscr.

Re: stage of programming

2024-05-14 Thread Misti Hamon
So, uh, this depends. The couple of times I went through the process of working for a "client" (in quotes because it was in school, and was an exercise they did trying to teach us about freelancing) it was handled two ways - client finds you and says "I need a program that takes this information an

Re: lines of code for code a website

2024-05-02 Thread Levi Elias Nystad-Johansen via beginners
This depends on the complexity and size of the website. A very simple website needs 0 lines of C, Java, PHP, or Perl - since it can be made with only HTML. Big and complex websites might need 100.000s lines of code, in multiple languages. -L On Friday, May 3rd, 2024 at 8:27 AM, William Torrez

Re: [announcements mailing list]

2024-03-20 Thread Mike
I am subscribed to the Perl Weekly: https://perlweekly.com/ Mike On 3/15/24 06:27, Maxim Abalenkov wrote: Dear all, How are you? I hope all is well with you. I’m wondering, do we have some kind of an announcements mailing list, that would highlight, what happened in the Perl world over th

Re: [announcements mailing list]

2024-03-15 Thread sisyphus
On Fri, Mar 15, 2024 at 10:27 PM Maxim Abalenkov wrote: > Dear all, > > How are you? I hope all is well with you. I’m wondering, do we have some > kind of an announcements mailing list, that would highlight, what happened > in the Perl world over the past week, month, quarter? What are the new >

Re: [announcements mailing list]

2024-03-15 Thread Andrew Solomon
Hi Maxim, This is the mailing list I see as a good source of general updates from the Perl and Raku community: https://perlweekly.com/ This is a more formal news site maintained by The Perl Foundation: https://news.perlfoundation.org/ This site was once providing lots of articles but needs someo

Re: Upgrade from Debian 11 to Debian 12 Broke Perl.

2024-03-13 Thread Ruprecht Helms (privat)
linux-gnu/perl/5.36 /usr/share/perl/5.36 /usr/local/lib/site_perl) at /home/martin/etc/p2 line 3. BEGIN failed--compilation aborted at /home/martin/etc/p2 line 3. So, if I try to use cpanp and re-add that module, I get: 1wb5agz martin tmp $ cpanp -i Warnings::Unused ERROR] 'Warnings::Unused

Re: Upgrade from Debian 11 to Debian 12 Broke Perl.

2024-03-13 Thread Ruprecht Helms (privat)
tc/p2 line 3. So, if I try to use cpanp and re-add that module, I get: 1wb5agz martin tmp $ cpanp -i Warnings::Unused ERROR] 'Warnings::Unused' does not contain an author part [ERROR] Cannot find 'Warnings::Unused' in the module tree “Warnings::Unused” != “warnings::unu

Re: Upgrade from Debian 11 to Debian 12 Broke Perl.

2024-03-11 Thread John SJ Anderson
-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.36 > /usr/share/perl/5.36 /usr/local/lib/site_perl) at /home/martin/etc/p2 line 3. > BEGIN failed--compilation aborted at /home/martin/etc/p2 line 3. > > So, if I try to use cpanp and re-add that module, I get: > > 1wb5agz

Re: [install and use local::lib module]

2024-02-17 Thread Mike
. Mike F. Houston, TX On 2/15/24 04:23, Maxim Abalenkov wrote: Dear all, How are you? I re-read the README file of the local::lib module. There was one more command missing: echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"' >>~/.bashrc My new Perl setting

Re: [install and use local::lib module]

2024-02-15 Thread Kang-min Liu
Maxim Abalenkov writes: > Now everything works. But I still don’t understand the setup very > well. What is the difference between the ‘.cpan’ and ‘perl5’ > directories? What is their purpose? Thank you and have a great day > ahead! The directory ~/.cpan/ is where the command `cpan` saves its

Re: https://metacpan.org/pod/OpenOffice::OODoc

2024-02-09 Thread Mike
I don't. Mike On 1/31/24 16:51, hw wrote: Ok and how do you do it with OpenOffice::OODoc? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: https://metacpan.org/pod/OpenOffice::OODoc

2024-01-31 Thread hw
On Tue, 2024-01-30 at 20:45 -0600, Mike wrote: > FWIW, in Spreadsheet::WriteExcel I do this: Ok and how do you do it with OpenOffice::OODoc? > $sheet = $book1 -> worksheets(2) -> {Name}; > $sheet = $book1 -> worksheets($sheet); > $sheet -> Activate; > > $sheet -> Range("B2") -> Activate; > $ex -

Re: https://metacpan.org/pod/OpenOffice::OODoc

2024-01-30 Thread Mike
FWIW, in Spreadsheet::WriteExcel I do this: $sheet = $book1 -> worksheets(2) -> {Name}; $sheet = $book1 -> worksheets($sheet); $sheet -> Activate; $sheet -> Range("B2") -> Activate; $ex -> ActiveWindow -> {FreezePanes} = "True"; Mike On 1/28/24 16:26, hw wrote: So how do I freeze rows/col

Re: Are there any ALSA Perl Modules?

2024-01-29 Thread sisyphus
On Mon, Jan 29, 2024 at 6:28 AM Martin McCormick wrote: [snip] > I may be looking in the wrong places but, so far, I seem > to be batting zeros when looking for perl and alsa together. > I take it that MIDI::ALSA (https://metacpan.org/pod/MIDI::ALSA) has little or nothing to offer ?

Re: Are there any ALSA Perl Modules?

2024-01-29 Thread Olivier
Shlomi Fish writes: >> Anyway, the FFI concept will probably someday come in >> handy for a different project so I will continue with the C I was >> working on. What I did in a project is having the main functionality written in C, but using Perl for things that could be handy like parsing

Re: Are there any ALSA Perl Modules?

2024-01-29 Thread Shlomi Fish
hi Martin, On Mon, 29 Jan 2024 22:38:27 -0600 "Martin McCormick" wrote: > Shlomi Fish writes: > > hi Martin, > > you can try using an FFI, eg: > > > > https://metacpan.org/dist/Inline-C/view/lib/Inline/C.pod > > > > https://metacpan.org/dist/Inline-Python/view/Python.pod > > > > https://meta

Re: Are there any ALSA Perl Modules?

2024-01-29 Thread Martin McCormick
Shlomi Fish writes: > hi Martin, > you can try using an FFI, eg: > > https://metacpan.org/dist/Inline-C/view/lib/Inline/C.pod > > https://metacpan.org/dist/Inline-Python/view/Python.pod > > https://metacpan.org/pod/FFI::Platypus Many thanks. I am glad I asked the question but it has taken me

Re: Are there any ALSA Perl Modules?

2024-01-28 Thread Shlomi Fish
hi Martin, On Sun, 28 Jan 2024 13:27:45 -0600 "Martin McCormick" wrote: > Several years ago, I wrote some C code which turns one's > computer's sound interface in to a sound-activated recorder that > I could then connect to radio receivers or microphones and record > when audio started and stop

Re: https://metacpan.org/pod/OpenOffice::OODoc

2024-01-28 Thread hw
On Sun, 2024-01-28 at 22:44 +0100, hw wrote: > Hmm, cellValue() always puts text. How do I put numbers and formulars > instead? Ok, it's cellFormula(), and you have to change the value type of every cell that should contain anything having a type different from the default type of the sheet. Ugh

Re: Are there any ALSA Perl Modules?

2024-01-28 Thread hw
On Sun, 2024-01-28 at 13:27 -0600, Martin McCormick wrote: > [...] > I may be looking in the wrong places but, so far, I seem > to be batting zeros when looking for perl and alsa together. > > Any good ideas are greatly appreciated, here. I would think that one nowadays would use (go

Re: https://metacpan.org/pod/OpenOffice::OODoc

2024-01-28 Thread hw
On Sun, 2024-01-28 at 12:21 -0800, Jim Gibson via beginners wrote: > Check out the OpenOffice::OODoc module on CPAN: > > > The documentation is a little sparse, especially with regard to “spreadsheet” > mode, and I don’t have Libre Office on my

Re: https://metacpan.org/pod/OpenOffice::OODoc

2024-01-28 Thread Jim Gibson via beginners
Check out the OpenOffice::OODoc module on CPAN: The documentation is a little sparse, especially with regard to “spreadsheet” mode, and I don’t have Libre Office on my system to test it out, but the following code produces an ods file that can

Re: https://metacpan.org/pod/OpenOffice::OODoc

2024-01-28 Thread hw
On Thu, 2024-01-25 at 20:28 -0600, Mike wrote: > It can be done with a Perl module: > https://unix.stackexchange.com/questions/723650/editing-libreoffice-calc-spreadsheets-in-the-terminal > > I have not tested that. I do not want to edit spreadsheets in a terminal. There's some other software fo

Re: https://metacpan.org/pod/OpenOffice::OODoc

2024-01-25 Thread Mike
It can be done with a Perl module: https://unix.stackexchange.com/questions/723650/editing-libreoffice-calc-spreadsheets-in-the-terminal I have not tested that. Mike On 1/25/24 13:05, hw wrote: Hi, is there a way to create libreoffice spreadsheets (ods) similar to Excel::Writer::XLSX? Th

Re: regex

2024-01-24 Thread karl
Mike: > I stand properly scolded. I didn't want to scold anyone, it seems I expressed myself wrong. Sorry for that. Regards, /Karl Hammar -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: regex

2024-01-23 Thread Mike
I stand properly scolded. Mike On 1/23/24 07:01, k...@aspodata.se wrote: Please stop using my mail address when replying, I'm on the list and don't want two copies of the same mail (it's not about you Mike). -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional command

Re: regex

2024-01-23 Thread karl
Please stop using my mail address when replying, I'm on the list and don't want two copies of the same mail (it's not about you Mike). Mike > Why is my Perl not working on that command? > > $ perl -e 'exit(10) if "aaa"=~/a{,2}/;' > Unescaped left brace in regex is illegal here in regex; marked b

Re: regex

2024-01-22 Thread Mike
Why is my Perl not working on that command? $ perl -e 'exit(10) if "aaa"=~/a{,2}/;' Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/a{ <-- HERE ,2}/ at -e line 1. $ But this works: $ perl -e 'exit(10) if "aaa"=~/a{0,2}/;' $ $ echo $? 10 $ It sure surprised me

Re: regex

2024-01-22 Thread armando perez pena
have a problem and you say I will solve it with regular expressions then you have two problems. Ánimos! Saludos From: Claude Brown via beginners Sent: Monday, January 22, 2024 10:49:50 PM To: k...@aspodata.se ; beginners@perl.org Subject: RE: regex Jorge

RE: regex

2024-01-22 Thread Claude Brown via beginners
Jorge, Expanding on Karl's answer (and somewhat labouring his point) consider these examples: $a =~ /Jorge/ $a =~ /^Jorge/ $a =~ /Jorge$/ $a =~ /^Jorge$/ This shows that regex providing four different capabilities: - detect "Jorge" anywhere in the string - detect "Jorge" at the start of a strin

Re: regex

2024-01-22 Thread Levi Elias Nystad-Johansen via beginners
I agree that this is confusing, and I think many resources describing regex in unhelpful ways is partly to blame. descriptions like "pattern that matches against a string" and similar. this implies that a regex has to match the string, but this is not the case. a regex does not have to match the

Re: regex

2024-01-22 Thread Andy Bach
Yes, the {}l RE modifier has the canonical form {a,b} where a and b are numbers and so that modifies the char before it to match from a to b times, e,g A{1,3} matches one, two or three As. If you leave out the first number, zero is presumed. Hmm, perl 5.30 % perl -E 's ay(10) if "a

Re: regex

2024-01-22 Thread karl
Jorge Almeida: > On Mon, 22 Jan 2024 at 13:00, wrote: > > Jorge Almeida: > > > $ perl -e 'exit(10) if "aaa"=~/a{,2}/;' ... > > {,n}Match at most n times ... > Yes, I read it (several times). I still don't understand it (I understand > what you're saying, and I trust you're right, I just

Re: regex

2024-01-22 Thread karl
Jorge Almeida: > Please help me to understand this: > $ perl -e 'exit(10) if "aaa"=~/a{,2}/;' > $ echo $? > $ 10 In man perlre, under "Regular Expressions" it says: {,n}Match at most n times So /a{,2}/ matches "", "a", and "aa" and is ignorant about what comes before and after (basica

RE: Using UNIX domain sockets

2024-01-15 Thread Claude Brown via beginners
The first difference I can see is that "echo" adds a newline, but your perl does not. Try adding the newline: my $cmd='{"command":["stop"]}' . "\n"; This is a wild guess! -Original Message- From: listas.correo via beginners Sent: Tuesday, January 16, 2024 6:26 AM To: beginners@perl.o

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: lambda array

2024-01-13 Thread Ken Slater
On Sat, Jan 13, 2024 at 12:41 PM Andrew Solomon wrote: > > when is an array in perl declared with [] instead of ()? > > Using the [ ] delimiters you are creating a *reference* to an array. > (Think of a reference as the memory address where the array is stored). So > > my $foo = [1,2,3]; > > is e

Re: lambda array

2024-01-13 Thread Andrew Solomon
> when is an array in perl declared with [] instead of ()? Using the [ ] delimiters you are creating a *reference* to an array. (Think of a reference as the memory address where the array is stored). So my $foo = [1,2,3]; is equivalent to the following, because given an array the \ gets the refe

Re: lambda array

2024-01-13 Thread hw
On Sat, 2024-01-13 at 15:00 +, Andrew Solomon wrote: > I think the line: > > reply_multi( \$daemon{xmpp_o}, \($adminuser{fromJID}, $fromJID), "blah" ); > > should have \(...) replaced with [ ... ] : > > reply_multi( \$daemon{xmpp_o}, [$adminuser{fromJID}, $fromJID], "blah" ); > > because >

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: lambda array

2024-01-13 Thread Andrew Solomon
I think the line: reply_multi( \$daemon{xmpp_o}, \($adminuser{fromJID}, $fromJID), "blah" ); should have \(...) replaced with [ ... ] : reply_multi( \$daemon{xmpp_o}, [$adminuser{fromJID}, $fromJID], "blah" ); because \('foo', 'bar') evaluates to (\'foo', \'bar') Does that clarify this for

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: [getting PAUSE account]

2024-01-12 Thread Andrew Solomon
Hi Maxim, I'm sorry to hear this hasn't been resolved! I've just asked on the perl-help irc.perl.org channel - feel free to join in, but otherwise I'll let you know what I learn. Kind regards, Andrew On Fri, Jan 12, 2024 at 6:00 AM Maxim Abalenkov wrote: > Dear all, > > How are you? Thank you

Re: Knowledge for a basic programmer and advanced programmer

2024-01-05 Thread John SJ Anderson
> If you are coding you should be backing up every > 10 minutes or more often. And you should store > a "historical" full copy of the code every 30 minutes > or more often and save them for days. No, you shouldn’t, because it is no longer 1985. You should learn how to use version control; the

Re: Knowledge for a basic programmer and advanced programmer

2024-01-05 Thread Mike
If you are coding you should be backing up every 10 minutes or more often.  And you should store a "historical" full copy of the code every 30 minutes or more often and save them for days. Mike On 1/2/24 10:33, William Torrez Corea wrote: On Tue, Jan 2, 2024 at 5:17 AM Shlomi Fish wrote:

Re: [getting PAUSE account]

2024-01-02 Thread Rob Coops
Just my two cents on this. There is no sense in putting one language over another if it is for personal use. In those cases use what you want and what you feel is best suited to your needs. You might Choose Perl as you are familiar with it and you need to process lots and lots of text for your pro

Re: Knowledge for a basic programmer and advanced programmer

2024-01-02 Thread Shlomi Fish
On Sat, 16 Dec 2023 08:10:49 -0600 William Torrez Corea wrote: > What needs to know a basic and advanced programmer? > > I am a basic programmer, I don't have enough experience to be an advanced > programmer. > > How many years of experience must an advanced programmer have? > hi William, I

Re: [getting PAUSE account]

2024-01-01 Thread Mike
That is true.  I don't see the appeal with Python, but I have barely dabbled in it.  I code for me and I know Perl.  I don't have the motivation to learn a new language. Perl works well, so I use it. Mike On 12/25/23 22:05, William Torrez Corea wrote: I am a beginner, I am learning of the b

Re: [getting PAUSE account]

2023-12-25 Thread Mike
Great question.  I think I did see that Pause accounts were going away soon, but I'm not sure that has taken place yet.  I just signed into my Pause account and I don't see anything about them being retired. This 3 year old post says it takes a bit of time: https://www.reddit.com/r/perl/comments

Re: perlbrew

2023-11-22 Thread Olivier
Hi, > > Try to change the version of my Perl but not change. What do you do to change the version of Perl? What command? On what system? > I have Perl v5.36.1, I tried to change Perl to Perl v5.10.0 but I didn't get > the > desired effect. > > I have the following error: > > A sub-shell is l

Re: Using qr// with substitution and group-interpolation in thesubstitution part

2023-11-21 Thread gordonfish
On 10/25/23 10:32, Josef Wolf wrote: [...] Basically, I want to do the same as $data =~ s/^foo (whatever) bar$/bar $1 baz/mg; but with a different interface (because it has to be embedded into a bigger project), So I have come with this; sub substitute_lines { my ($contents,

Re: Perl Design Patterns

2023-11-18 Thread wesley
you can choose to not use it. > > When must I use perl design patterns? > -- > > With kindest regards, William. > > ⢀⣴⠾⠻⢶⣦⠀ > ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system > ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org https://www.debian.org/ > ⠈⠳⣄ > -- To unsubscribe, e-mail: beginners-unsubscr..

Re: Preference

2023-10-30 Thread Rob Coops
In this day and age Kotlin is probably your best bet but if you take on Java you are 90% there with regards to Kotlin. As for Perl, unless you are in a very specific niche Perl is pretty much dead as a commercially viable option as there are too few people that are halfway decent at it so no compan

  1   2   3   4   5   6   7   8   9   10   >