lainchan / λ

Understanding The Purpose Behind Using "Dead Languages"

drop · 2021-11-07 05:08
I am wondering why many of you here like to use programming languages that are "dead" or have been replaced, examples being C, Lisp and Haskell among others. Don't get me wrong, there is nothing wrong with a language that isn't shoved in your place every time you log onto the wired I am a PHP and SQL developer myself but I do not understand why you continue to use these languages that have been replaced in my opinion. Is it for work? Is it to make yourself feel special? I am not trying to be rude but I see no reason to continue to use these languages for many use cases. What do you guys even do for projects? Hello World in 100 different Lisp dialects? I have an open mind so please help me understand. Excuse the poor English as well please.
Just another Random Lainon · 2021-11-07 06:41
Lol PHP should've been dead and buried a long time ago.
Agent Smith · 2021-11-07 07:02
>why Because the software written in my dead lang is better, especially better than php which soykafs the bed all the time. Being "dead" doesn't mean all software is 100% bugfree or such (and there are langs which you call "dead" like C which soykaf the bed) but things like haskell just happen to be "dead". If you want to know what cool things haskell has you will need to as a PHP dev level up your IQ which will allow you to learn haskell (or at least comprehend why people do it and if it's not for retarded reasons also join them) >is it for work No there is no work >hello world in 100 lisps Some retards just do that
Emmanuel · 2021-11-07 07:56
>>28440 >Because the software written in my dead lang is better I cannot tell if you are being possessive as banter or if you are being serious. If you are being serious what programs have you written in Haskell? Doesn't need to be a github but a description would be nice and reasons why using Haskell was better for the job as opposed to more modern languages. >>28442 It gets the job done, you can spend 2 weeks writing your backend in Emacs Lisp or you can spend 2 hours writing it in PHP.
Nanashi No Gombe · 2021-11-07 08:20
>>28438 >I am a PHP Wow, anon, PHP is even more dead than C. At least C is still used in modern hardware, but PHP is only for legacy codes. It's at the same level of Fortran at this point.
Lady 3Jane.. · 2021-11-07 09:09
How are C, Lisp and Haskell dead or replaced? >C The standard keep being revised (cf C2X), gcc/clang are still being developed a lot and are amongst the most optimizing compilers there are and compcert is a thing without equivalent in any comparative (imperative) language. Most kernels and a big part of most userspaces are built in C, boy. I don't see any replacement with a similar simplicity: Zig has an ugly C++ tier syntax, Jai is vapourware. Maybe DeVault's new language. Maybe. >Lisp Common Lisp's standard is stale and disgustingly useless, but the user ecosystem is thriving and multiple implementations (SBCL, ECL, CCL) are still alive (and not just surviving). As for Scheme, R7RS-large continues and major implementations like Racket, Chez, etc.. aren't dead either. I've yet to see something as powerful as Common Lisp's macro system and general good design. >Haskell Eh, don't know. Is this just your first troll? Or do you mean that any language that doesn't have a troon brigade hyping it on social medias and breaks every day because ANSI standard backed languages are no fun is "dead"? I use C, Tcl (which is arguable dead) and Common Lisp because they can't be replaced completely.
Erik Johansson · 2021-11-07 09:52
>>28438 I'm weird, I just enjoy learning different ways of thinking and expressing problem-solving. I spend a lot of time learning and using esolangs, "dead" langs, new langs, etc because I see value in forcing myself to try and approach problems differently. It's just born from a love of computing science and language theory, there really isn't a good reason beyond it being fun, cool, and educational. I dunno about other lains, I just like to learn languages and presumably learn something valuable in the process. I'm weird..
Cowboy · 2021-11-07 10:17
>>28444 PHP is alive and well among medium sized companies that aren't about tech but still need it to power their web services. Plus its fun and easy for hobby projects >>28445 Apologizes for the poor wording. I am saying that in most cases these languages are not the best tool for the job and I was wondering if there are any frequent cases that you yourself have experienced where using an old or "dead" language was better than using a modern one. >>28446 Thank you. This is actually an answer that I was looking for. A love of learning is what drives it for some I see.
t · 2021-11-07 10:19
I concur that, before you can understand why people use dead or replaced languages, you need to understand what the fuarrrk you mean by 'dead' and 'replaced', and then explain it to us. No meaningful discussion can proceed from a meaningless premise.
William Holtzer · 2021-11-07 12:22
"Dead" languages prove their worth when a project to update them utterly fails to deliver the same reliability and performance levels
Hagbard Celine · 2021-11-07 12:58
>>28447 >Plus its fun and easy for hobby projects Why would we even allocate time to a fool who thinks PHP is "fun"? Mowing a lawn with a nail clipper would probably be funnier than using PHP. Graham may be a bit meme-y at times, but his Blub lang thing fully applies here. Anyway, if you want an argument that's globally applicable to what you seem to mean by "dead": conservatism. Knowing your C or CL project will compile and work perfectly or almost 20 years later has a much bigger than you think; and only when this is managed without having to fix a bad initial design by piling on it unearthly amounts of band-aids each couple of years (C++).
Lukasiewicz · 2021-11-07 13:00
>>28450 s/much bigger/& impact/
() · 2021-11-07 13:58
>>28450 In defense of OP PHP has gotten better and many websites still use PHP as a (backend? middleend?) because it is easy to setup. I can't say much more because I've never used PHP but I'll get back to you when I spend time learning it. I think lainchan is running PHP 7.
Nameless · 2021-11-07 14:00
>>28438 >but I do not understand why you continue to use these languages that have been replaced in my opinion. Lisp for example is fun to use because the syntax is well designed, simple and gives you expressive power not seen everyday in other languages. Generally just because a language is what big IT corporations currently use, doesn't mean it is good or pleasant to write programs in.
protected · 2021-11-07 14:52
>>28452 The (only?) implementation has gotten faster and lots of band-aids have been applied, but as I've said in my previous post, you can't "fix" a language with a bad core without starting again from scratch.
Tyrell Wellick · 2021-11-07 15:05
>>28454 What makes it bad though? The thing is I feel like it's just trendy to hate PHP, even though it's literally one of the best things for stuff like small personal sites with how much and easily you can experiment with it. I know, because I've tried Python with Django, Java with Struts and Rust with Actix. And all of these are a fine option for big projects, but for the average person who wants to set up a website PHP is a joy to work with compared to other options. Yes, it started as a low effort hobby project, but if facebook in large part runs on it, what can an average small business owner or someone making a personal site complain about it?
Leto Atreides I · 2021-11-07 18:13
There are many many answers, but here's one that's possibly less pragmatic than the rest: >because PHP is a pain to work with, while Common Lisp is a joy to work with. Subjectively, of course, but holds more often than not.
Masami Eiri · 2021-11-07 20:05
>>28456 >What makes it bad though? There's a legendary writeup on this exact topic at https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ . A handful of things have changed in the 9 years since it was written, some good, some bad, but overall it's still a highly relevant and thorough critique of PHP.
Tomohisa "Tom" Kanezaki · 2021-11-07 20:46
>>28438 If the programmer is enjoying themselves then even if they were writing programs in Brainfuck that would be reason enough wouldn't it?
overriding · 2021-11-08 10:45
>>28456 >it's literally one of the best things for stuff like small personal sites with how much and easily you can experiment with it. I know, because I've tried Python with Django, Java with Struts and Rust with Actix Is that not your problem? You're comparing vanilla PHP to huge frameworks in other languages. Compare it to the vanilla languages instead. I know that Python at least has support for CGI in its stdlib, because I wrote a few scripts with it back in the day. What you may not get out of the box is the preprocessor part of PHP (i.e. embedding PHP in HTML), but I'm sure ways around that have feen figured out.
Yuki Nagato · 2021-11-10 05:42
>>28438 >C, Lisp and Haskell among others. One of these, is not like the others, moron. C still powers the most critical infrastructure to date The rest are delusional LARP languages on the other hand, and if you can't see the point in them, that's fine, because i can't either, It's all subjective Ignore the rest of these idiots ITT, Their arguments straight up sound like Theodicies, >But Lisp can write prooooofs >>28444 >>28442 A little offtopic but whether you like it or not PHP still powers at least 50% of the web if not more, and it will keep up. I don't even like PHP but it's so obvious the majority of you making these shoddy arguments can't write in it.
Bobby Newmark · 2021-11-10 05:51
>>28493 So does C, yet OP is talking soykaf about it while praising PHP.
Mentat · 2021-11-10 14:07
ITT: PHP is the C of backend webdev
byte · 2021-11-10 16:34
>>28438 Its fun. Its like asking, "Why do people still shoot film" or "Why do people still drive manual".
Hong, Guil Dong · 2021-11-10 17:40
>>28456 >What makes it bad though? I've been programming PHP for 7 years. I've done 10000+ loc projects excluding external packages (I've started with PHP thanks an internship with WP) and as >>28468 says: the baked in preprocessor is the only thing it has going for itself, and thats not much. PHP arrays are soykaf, array manipulation functions are soykaf, debugging&errors are soykaf, even though there's Psysh - the repl is still soykaf. These should deter you from trying. But hey, experience the strange behavior yourself. Once PHP is your goto guy and you try something more than the ez fix you'll find that its not intuitive and you'll have to remember all the fuarrrking quirks or you'll soykaf the bed unexpectedly often enough. Luckily REST APIs are a common thing nowadays, so I don't have to use it that often anymore.
The Phantom Phreak · 2021-11-10 20:10
I'm no fan of PHP but there's no alternative that let's you freely modify and update code on your web server without any downtime. <1 second downtime from executing some blue-green script still counts as downtime, don't bother replying.
Hacker · 2021-11-11 02:48
>>28505 Just use CGI, glitterboy.
cdr · 2021-11-11 08:27
>>28505 Plenty of languages allow you to replace parts of a running live image at will, see Common Lisp or Erlang for example.
typedef · 2021-11-11 09:41
>>28505 That's literally the entire point of Erlang but okay.
list · 2021-11-11 10:11
>>28500 Not even close. Lots of experienced programmers hate C, but you'll also find plenty who swear by it. People for the most part dislike C for subjective philosophical reasons rather than objective technical ones. It has its fair share of flaws, but it's good at what it sets out to do, and whether you like it or not depends on if you agree with its goals. PHP is more like COBOL. You'll never find anyone with real world programming experience in a language that isn't PHP willing to defend it, because it's a bad language. The only people who use it are bad programmers who don't know any better, and good programmers who need to deal with software already written in it. Like COBOL, PHP's large market share comes almost exclusively from things that were already using it before better alternatives came along and aren't worth the effort to rewrite in more sane languages. Basically no one starts a new project in PHP nowadays, and for good fuarrrking reason.
Cereal Killer · 2021-11-12 01:04
>>28438 >examples being C C is still alive and well in the embedded world. >I am a PHP and SQL developer myself that's ironic cause PHP is one of the few languages that's ACTUALLY dying, according to all the stats and surveys I've seen. regarding Lisp and Haskell, these aren't deadlangs cause they were never that alive to begin with. They're mostly for hobbyist nerds who program in their free time, like the type of person who would build emacs as a passion project, and for CS scholars/academia, especially those interest in programming language theory. I'm not into this stuff myself but I get the appeal in niche languages, you can learn stuff that you then take with you to the more traditional commercial languages. That's how we got all the functional features we have in OOP langs over the years.
The Oracle · 2021-11-12 07:28
replaced by javascript and go? fwark off
Dox · 2021-11-12 16:02
>>28513 >The only people who use it are bad programmers who don't know any better, and good programmers who need to deal with software already written in it. One of my endless ongoing frustrations at my small-office job is PHP. Just because I have a programming hobby outside of work hours, the boss wants me to maintain our Wordpress site (which is basically a glorified "contact us" page). And he's absolutely adamant about not changing from a soykafty shared-hosting PHP-or-nothing no-TLS host to a proper TLS'd VPS. And he wants it flashy. Yeah - no TLS. We can't even login securely. fuarrrking Wordpress, man. If Satan himself appeared in front of me and offered to remove Wordpress from the world, I'd sign the contract in a heartbeat without reading the fine print.
null · 2021-11-12 16:12
>>28532 >no TLS Sounds like a good opportunity for a gayop, make him switch by causing some problems.
Boris Grishenko · 2021-11-12 21:12
>>28532 WordPress is removed but all web pages are loaded with adobe flash. Do you take that deal?
Nobody important · 2021-11-16 12:52
>>28438 I don't know about Lisp, but C and Haskell are still used plenty "in the wild", C is the gold standard for embedded programming and Haskell is used extensively in the finance industry. Haskell first appeared in 1990, this is around the time that other still commonly-used languages like C#, C++, Java, and JavaScript appeared. Only someone with no experience in the developer world whatsoever would call these languages "dead". To answer your question directly, when people program recreationally they do it for the experience of programming, and this experience can be different depending on the language you use.
Drano · 2021-12-01 06:09
>>28535 >WordPress is removed but all web pages are loaded with adobe flash. Do you take that deal? Oh you naughty person. That's an evil choice. I suppose I might tolerate the continued existence of Wordpress in that situation, because I despise close-source runtimes on principle even more than I despise Wordpress.
Anamika · 2021-12-01 11:58
>>28535 >>28718 People complain about the current state of the web, but it could've been way way way way worse. Back in the late-90s/early-2000s, it was a very real possibility that the future of the web was Internet Explorer, Adobe Flash, and Java applets.
Lunch · 2021-12-01 13:16
>>28568 >C is the gold standard for embedded programming it isnt, C++ is
Spike Spiegel · 2021-12-01 13:54
>>28731 oh my god, applets I DONT WANT TO GO BACK
quote · 2021-12-02 04:27
>>28731 Yeah. I'm an old fart, I remember the early 2000s web pretty clearly. It really was a dark time. I don't get all "get off my lawn" much, but every time I hear someone lament the death of Flash because it means they can no longer play the web games from their childhoods, I want to just start slapping them and not stopping.
Stallman · 2021-12-02 12:18
>>28764 >>28738 >>28731 When I was in high school I took a web design class. We never talked about HTML, JS, or CSS. We did the entire course in Flash. It was "the future of web" or some soykaf. I wonder if anyone is still writing in actionscript 2.0. That's got to be an actual dead language by now
Agent Richard Gill · 2021-12-03 11:49
>>28776 hahahaha oh man That's taking me back to my HS computer graphics class, too. Thank god it's dead, but I'd put money on it that some poor dev somewhere is still maintaining something "critical."
Hiro Protagonist · 2022-01-30 20:49
>>28438 >PHP and SQL Both of which are written by large parts in C. Have you thought of that?
Stallman · 2022-01-30 22:02
>>29837 >C which compiles mostly to assembly language. >assembly language pfft, it's just being translated to microcode under the hood >microcode ugh you don't use physical transistors to wire in your logic? Didn't realize you were a NOOB
array · 2022-01-31 03:11
>>29838 >Not doing computing at quantum levels and then collapsing the result. Are you a human or why is it so hard to just do it right.
null · 2022-01-31 07:56
>>28438 > I do not understand why you continue to use these languages that have been replaced in my opinion. >"dead" examples being C What are you talking about TIOBE has C in 2nd place, and its been in first up until now. And the fourth most popular (C++) is a C derivative anyway. Virtually all systems development is done in C, including Windows and Linux. Virtually all operating system utilities are written in C. Bind9, and therefore most DNS infrastructure runs on C. Apache httpd is written in C. Python is written in C. PHP is written in C. What are your credentials that you get to declare C dead? What has replaced it?
Iverson · 2022-01-31 08:22
>>28438 Common Lisp is guaranteed to be 100% stable language. Libraries and software written in Common Lisp are also guaranteed to be compatible. Also, you can still expand the language using macros. To learn more, install SBCL, read https://gigamonkeys.com/book/ and come to the relevant thread here >>27327
Jane Doe · 2022-01-31 11:26
the bigger question is why do people use "alive" languages?
Davis · 2022-01-31 13:25
As many lainons already mentioned in the thread, the languages you have mentioned are not dead. C is still the backbone of a lot of our current computing environments (kernels, runtimes, ...) and is used a lot in embedded applications, C will outlive us all. Lisp is at the very least still used by Emacs aficionados, and >>29843 provided another good reason why CL is still relevant, and it's the reason behind the creation of CLASP: Common Lisp is a stable standard. It's also the most practical way to tinker with an image-based development environment, since Smalltalk and Self are mostly dead. While Haskell's popularity waned somewhat since the early 2010s, it is still used in nice projects like shellcheck and TidalCycles, and there are very interesting ideas baked into the language from the first principles. However, it's true that lainchan has always been attracted to niche languages like FORTH, APL and Idris. The simplest rationale behind this is that those obscure languages can teach you unorthodox computer science concepts. Sure, most of what we have to do day to day at the average programming job is juggling between a bunch of if/else statements, for loops and manipulating the state of some structs/objects, and it doesn't need to get much fancier than that, but it's a good hobby to experiment with other ways to express an equivalent computation.
quote · 2022-01-31 18:34
>>28438 You use 'dead' languages because you realize all languages are restrictive bloat nonsense, uninteresting and uninspiring
Agent Jones · 2022-02-06 20:07
>>28438 C hasn't been replaced. Here's the secret with C -- it's the only language in wide use that *is* the operating system. Lisp hasn't been replaced. In fact, most people *still* don't understand what Lisp is and does. They just think of it as a language with funny syntax. Haskell has very niche use in academic circles but isn't replaced yet because of its niche nature.
Void · 2022-02-07 11:15
>>28438 >Is it for work? I hear that there's still alot of old infrastructure that still requires old languages like Fortran or Haskell. If you ever look at gov. job listing, for example, you might see a few job openings asking for people who know these dead langs to maintain their stuff or upgrade it. (if they ever think of it) If it's not for work, then it's probably for just general knowledge. You might want to learn more about C if you are using Rust, Lisp if you are using Closure, etc... Or, it's probably the very based opinion that Lain just prefers that language over anything else.
Noodle Soup -1/7 · 2022-02-07 13:20
>>28438 How tf can OP think C is a dead language? or one that's been replaced? what's the replacement, cringy rust? go tell jokes somewhere else, dude. I'm not a C programmer but even i can see that C is pretty alive.
Bobby Newmark · 2022-02-07 15:35
>>29992 I'm not sure if you're aware, but C-- is an actual language; it's a super stripped-down version of C meant to be emitted as an IR for other languages. The GHC Haskell compiled actually uses a variant of it. >>29998 Calling a programming language "cringe" is the most teen thing I can think of.
Crystepsi · 2022-02-08 05:07
because its fun -_- why else would we?
Case · 2022-03-21 13:24
>>28438 > examples being C, Lisp and Haskell C is far far from dead, it's used in all systems programming for one thing. Lisp and Haskell aren't dead either, both are actively developed and used in production, they are just a bit niche. Haskell is especially popular in academia and fintech having no real competitor in the space of pure functional languages. Many concepts, making their way into more common languages like pattern matching, higher kinded types, type composition over inheretince, etc. were first implemented in Haskell. So even if you're not going to use Haskell in your field or career it's beneficial for expanding CS knowledge and becomming a better programmer. Examples of dead languages would be: Fortran, SmallTalk, Pascal, Perl. These may have legacy support and some others learn them just as a historical exercise, but I agree in these cases it's mostly a waste of time.
Church · 2022-03-22 08:52
>>30478 Akshually, Fortran is still used for high-performance statistical computing.
The Phantom Phreak · 2022-03-23 18:02
>>30478 >pushes in glasses >C is far far from dead, it's used in all systems programming for one thing.
Wintermute · 2022-03-23 18:02
>>28438 >i am a PHP dev LARP because no business has used that soykaf for 10 years
Miho Iwakura · 2022-04-06 07:29
>>29999 Teen's not wrong, the very existence of rust makes me cringe
Lord Nikon · 2022-04-06 15:48
>>30668 I don't know why. Rust is obviously far from a perfect language, but its goal of implementing high-level features in a performant manner is a noble one.
Hacker · 2022-04-11 13:34
>>30478 Fortran is far from dead. Go to any engineering/physics/chemistry department or company and you are likely to find new code being written.
setq · 2022-04-11 14:21
>30718 and I am angry at some of the fuarrrking new fortran 2018 features that no normal fortran user ever wanted what the fuarrrk fortran what the actual fuarrrk.
Nanashi No Gombe · 2022-04-11 16:32
>>30718 As an Electrical Engineer who learned Fortran, this anon is right.
sizeof · 2022-07-14 20:24
>wired I am a PHP and SQL developer >wired I am There are guys me that are just hobbyist that do stuff for pure fun. I like Common Lisp since I can do a lot of absurd that makes people annoyed just by the mere existence of my code. That it. I'm just the old fashioned curious guy doing absurd things and laugh at the results. I love what I do, and I was wise of not make my hobby what makes me fill my fridge, so, programming, for me, it's all about about have fun and make people mad with me.
Drano · 2022-07-14 20:38
>>28764 Well Flash was awful on a technical sense but so far there's nothing that have matched in on terms of ease of use and power to create cross platform interactive content by the average Joe. The canvas API took forever and isn't as easy to use. Maybe the idea could've worked on less incompetent hands. >>30478 Perl is overhated, for one off one liners is miles better than memorizing differents switches of AWK and sed or dealing with the limitations of their POSIX counterparts, and breaks less tha Python.
Six · 2022-07-15 09:17
>PHP developer >Geniunely wonders why nerds even know words like "Lisp" and "Haskell" Every. Fuarkking. Time. Have you ever witnessed a beauty of mathematical abstraction? Rhetorical question. I already know you have not.
Hououin Kyouma · 2023-03-13 01:34
I like Ada, because it's practical and has expanded my mind. >Is it for work? >Is it to make yourself feel special? No. >What do you guys even do for projects? >Hello World in 100 different Lisp dialects? In Ada, I'm implementing systems where I want to control memory allocation, avoid exceptional situations, and use my system interfaces. I can implement my software as finite state machines where possible; strong, nominative typing allows me to design away many classes of failure; and I can write bindings to non-standard system functionality according to my designs, such as Internet communications, without needing to wrangle different interfaces for it like I would with Common Lisp, as an example.
Arisu Mizuki · 2023-03-13 09:13
>>28456 Yes it is trendy to hate PHP, it's also trendy to hate Perl and C. It's okay though, we'll just keep getting stuff done while these folks complain about century old memes.
HUN · 2023-03-13 15:02
>>28438 >examples being C Where you took this from? 70% of the code running on my machine is C/Lisp. When something gets thing done, you don't need to change. Change for the sake of change is unproductive. You don't fix what isn't broken. People who hop from language to language, framework to framework, tool to tool, will never master any of them. See those distro hoppers? See those people that for every problem have the mindset of "I'm going to find the best tool to solve it"? A tool is just as good as you can use it, most tools you need a lot of time to master. I remember when nodejs was a new thing, basically every website had an eval bug somewhere on the backend, when all devs were blocking the event loop all the time, etc... Certain things require time, lesson in life, never be the lab rat for someone else tech when your income depend on it. Productivity is archived when you can move forward without googling every 30 minutes a new problem.
Demeere · 2023-03-13 16:13
>>34719 >It's okay though, we'll just keep getting stuff done while these folks complain about century old memes. People don't dislike PHP and Perl because they're "uncool" or whatever, they dislike them because they're flat out poor tools. You technically can get work done in either of those languages, they're not unusable or anything. But in the long term, you're going to be a lot more productive if you opt for something like Python or Go.
Yuki Nagato · 2023-03-13 17:09
>>34729 Perl is an amazing too for superseeding sh/grep/awk/sed. It's when you try to build large systems that I think people fail the discipline problem. PHP is an unironically good language with a lot of horrible history, and cruft that has yet to be removed, making it difficult to safely use. Luckily it's been infested by Java developers and they are moving away from old style PHP, whether it will be better or not is yet to be seen, but PHP 8+ is genuinely a pleasure to use compared to PHP 5, or compared to Perl, or compared to ECMAScript 5.
Cypher · 2023-03-13 17:25
>>34729 Modern PHP is fine. It will never outlive its poor reputation of being a footgun filled piece of soykaf that people only used because it coupled nicely with HTML. An insane number of web vulnerabilities can be traced back to PHP - but so was Java and any other high-level network/internet facing languages. I'm not sure if PHP was any less secure than Java was back in those days - but modern PHP is fine as long as you stick to only using the modern parts of it. People dislike Perl for an entirely different reason. They think Perl code is "fuarrrking illegible write-once-read-never" which is only true of one-liners. Unfortunately the majority of people who wrote Perl early on were UNIX hackers who wanted one liners for stuff they couldn't easily do in Bash. So you get stupid soykaf like ` % perl -p -e 's/^(\d+)/1+$1/e if $. > 50` what does that do? fuarrrk if I know, Google it. People abused Perl as a scripting language and so it has a bad reputation as an illegible scripting language. Would I use Perl over any modern language? Absolutely not. Is it a bad language? I haven't used it enough to say but it doesn't offer me anything that more modern languages don't do better so its a hard sell. Shit like this is why people hate Perl: https://gist.github.com/joyrexus/7328094
Jens Hansen · 2023-03-13 18:06
>>34733 i think it matches any line number if it's over 50 and if it is it prints the next one after itself it did take me 'man perlcheat' for $. as I havent used that before/recently. I personally like perl and I think it's well suited to once in a while use but I never had to use it in anger or in a team
Jet Black · 2023-03-13 18:56
>>34734 Not a bad guess, but this is why Perl is like kicking dead whales down the beach. Even if it is a contrived example because it assumes a specific file structure where each line starts with the line number. It skips the first 50 lines and then adds +1 to the number at the start of the line for every line after. You'd use it for updating a numbered list - like in the pre-markdown days of text editing where the list didn't programmatically update its own count. For example: 1 2 3... 49 50 <-- this is new 50 <-- this is the old 50 but should now be 51 51... <-- this should now be 52, and so on for all future lines
drop · 2023-03-13 20:19
>>34738 ahh I should've known. this doesn't edit the file in place though, right, it just prints the modified example?
Cereal Killer · 2023-03-13 21:02
>>34745 Correct. You'd normally be piping the input and output or if you don't care about destroying any links to the file you can use `-i`. `cat input | perl -p -e 's/^(\d+)/1+$1/e if $. > 50' > output` (input,output) `perl -p -e -i.bkp 's/^(\d+)/1+$1/e if $. > 50 input'` (input.bkp, input)