Re: lines of code for code a website

2024-05-03 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 Corea 
 wrote:

> How many lines of code are needed to code a website?
>
> in c, java, php and perl
>
> What language is ideal for this task?
>
> --
>
> With kindest regards, William.
>
> ⢀⣴⠾⠻⢶⣦⠀
> ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
> ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
> ⠈⠳⣄

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 string, instead the string has to satisfy 
the regex.

"aaa" satisfies /a{,2}/ because it contains everything the regex requires.
thinking of regex in this way has been a help to me atleast 

-L

 Original Message 
On 22. jan. 2024, 13:23, Jorge Almeida wrote:

> Please help me to understand this:
> $ perl -e 'exit(10) if "aaa"=~/a{,2}/;'
> $ echo $?
> $ 10
>
> Thanks
>
> Jorge Almeida

Re: Modules

2023-10-24 Thread Levi Elias Nystad-Johansen via beginners
I use modules for complex things that I might get wrong. To re-use other 
people's code is often better than to re-invent their solutions.

https://metacpan.org/pod/WWW::Mechanize::Examples has some good examples of 
useful scripts that are short and simple.
Imagine how hard it would be to write the same scripts without the module.

When I have an issue that I think others must also have faced, I look for a 
module to solve the issue.

But I am critical to modules that are outdated/abandoned, heavy with many 
dependencies, or unproven with few downloads etc.

I also remove modules when I no longer need them. I find this easier with 
App::cpanminus

- L

 Original Message 
On 24. okt. 2023, 17:31, William Torrez Corea wrote:

> When I must use modules and when I don't must use?
>
> I am working without modules, only i use:
>
> - Subroutines
> - Control flow
>
> My programs are short and simple, they do not exceed 15 lines. I think that I 
> need more practice and learn more about Perl. I have limited knowledge in 
> Perl.
>
> --
>
> With kindest regards, William.
>
> ⢀⣴⠾⠻⢶⣦⠀
> ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
> ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
> ⠈⠳⣄

Re: Perl version 5.8 and 5.10

2023-10-08 Thread Levi Elias Nystad-Johansen via beginners
Hi,
What is your use case, maybe it can be solved by adding "use v5.8;" or "use 
v5.10;" at the top?

It is rarely needed to install such an old version of perl, unless it's for 
testing compatibility, but then we should aim higher than v5.8.
v5.16 is the oldest version supported by toolchain, supporting older versions 
than that makes little sense in my mind: 
https://wikipedia.org/wiki/Perl_5_version_history?lang=en

-L
--- Original Message ---
On Sunday, October 8th, 2023 at 2:53 AM, William Torrez Corea 
 wrote:

> I Tried to install perl version 5.8 and 5.10 with perlbrew but i can't 
> install this version.
>
> I get the following error message:
>
>> 50 tests and 269 subtests skipped.
>> make[2]: *** [makefile:701: _test_tty] Error 29
>> make[2]: Leaving directory 'perl5/perlbrew/build/perl-5.8.0/perl-5.8.0'
>> make[1]: *** [makefile:709: _test] Error 2
>> make[1]: Leaving directory 'perl5/perlbrew/build/perl-5.8.0/perl-5.8.0'
>> make: *** [makefile:779: test_harness] Error 2
>> # Brew Failed #
>
> --
>
> With kindest regards, William.
>
> ⢀⣴⠾⠻⢶⣦⠀
> ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
> ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
> ⠈⠳⣄

Re: My progress in Perl

2023-08-07 Thread Levi Elias Nystad-Johansen via beginners
Hi,

Learning Perl is a great book, but anyone looking for an alternative should 
check out Minimal Perl by Tim Maher. I've found this book to be a little 
clearer and with more practical examples.

I've used Perl on windows for years, as it is far more powerful and portable 
than Batch and Powershell. Of course I also use it on mac and linux, and I can 
use the same scripts on all platforms :)

Most of my coding has been in making small command line utilities.
Like a script for renaming multiple files at once - which I use a lot for 
renaming photos from my camera and downloaded movies.

And one that runs a command whenever a file changes in a directory - I use this 
all the time for automatically running tests when I make changes to a code base.

I also use perl every time I need to process or generate reports.

While other languages, like python, offer more employment opportunities, I 
don't see myself switching. Perl is simply better and more suited for the tasks 
I use it for.

Perl has stronger regexes than anything else, has custom delimiters to avoid 
leaning toothpicks and similar issues, and allows for quick building and 
manipulation of strings, lists, and hashes.

-L

--- Original Message ---
On Sunday, August 6th, 2023 at 5:23 PM, William Torrez Corea 
 wrote:

> I started testing some extensions of CPAN but I don't understand anything. I 
> only execute and then proceed with a book. The name of the book is Beginning 
> Perl of Curtis Ovid Poe.
>
> I started with a lot of passion but then lost interest, the monotony 
> conquered me. Actually I am learning references and Complex Data Structures 
> in Perl.
>
> I have a lot of doubts in my mind:
>
> What is my purpose with this language?
> In my country don't exist use of this language
> I am boring and tired
>
> I must be a success!
>
> PD: Add your anecdote with this language.
>
> --
>
> With kindest regards, William.
>
> ⢀⣴⠾⠻⢶⣦⠀
> ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
> ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
> ⠈⠳⣄

Re: telephone book

2023-06-22 Thread Levi Elias Nystad-Johansen via beginners
Hi,

Not sure exactely what you mean, but here is a one-liner that'll produce 100 
phone numbers in sequence, from a random starting point:

perl -E '$start = 10_000_000 + int 89_999_899*rand; say for $start..$start+100'

Hope it helps :)

-L

--- Original Message ---
On Thursday, June 22nd, 2023 at 1:49 AM, William Torrez Corea 
 wrote:

> What do I need to do to develop a telephone book in Perl?
>
> In my country the phone number has 8 digits, i want to generate random 
> numbers but with the same sequence. I want to get at least some number 
> registered in the telephone exchange [unknown number].
> --
>
> With kindest regards, William.
>
> ⢀⣴⠾⠻⢶⣦⠀
> ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
> ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
> ⠈⠳⣄