I just pulled a PHP site out of my archive that I had taken down 7 years ago. Only one function call (each) had been removed, and everything else still works. There's been some major changes in some parts of PHP though; if I had been following along, I'd have gotten a deprecation warning, but I jumped two or three major versions.
I'd be pretty confident in any Perl code written for 5.8 or newer to continue working, with CPAN libraries as well. Earlier code is probably ok as long as you don't deal with binary data or non-ascii characters; 5.8 was the unicode reckoning.
If you ran FreeBSD 4, most of FreeBSD 13 will feel familiar. Although if you had a kernel driver for FreeBSD 4, it will likely need a lot of help to work in FreeBSD 13.
Of course, there are other communities where everything is thrown away every 6 months. I don't have that kind of time.
I issue a `cargo update` to upgrade the leaf dependencies and do automatic minor version updates. Issue cargo check. Some new warnings from `clippy`, but it still compiles and runs without problems. Could have deployed for 5 more years, but I decided to experiment more...
I upgrade some of the libraries to major new versions - I am experienced and I know which ones will upgrade without problem. They do upgrade without problem. Could have deployed for 5 more years but decided to walk the extra mile...
I upgrade the more problematic ones, especially actix_web, the web framework, which had a massive rewrite and a huge new release with almost completely different API surface... It's a bit difficult to understand the changes, especially some parts of the old code written for the old version (which I no longer remember), but in an hour I'm done. Afterwards `cargo outdated` does not report any outdated libraries. I deploy for the next 5 years. Zero problems since then.
Well, it's not decades yet, but I can imagine similar effort to maintain it over the next decade.