And I would recommend equally that you learn both. And PHP while you're at it. (I'm quite serious.) You're probably going to find all three of these already-installed on every system you meet on the street.
Yes, I'm saying
learn several. Also, carefully observe the techniques that are used in
both of the books you named. Notice not only how they're applying their language-de-jour to the problem, but especially notice what problems they are applying them to!
In each case, one of the key benefits of these languages is the rather-vast amount of
existing, debugged software that you can install, if it isn't already installed, on your machine. For example, if you'd like to have a full web-server, you can create one with literally one line of Perl code (which of course loads-and-runs a program object that's implemented in several thousand lines by somebody
else!). This is the kind of "programming power-tool" ability that's really the bread-and-butter skill of any and every sysadmin.
Even though you should as a matter of course be familiar with tools like bash-scripting and sed, largely because you
will encounter them, the Linux environment is frankly
stuffed with excellent, full-featured language implementations ... all free. These are your stock-in-trade. You can write "a command" in any of them, thanks to the magic of
#!shebang, and these are all tools that are specifically
designed to be used for creating programs, big or small as the case may be. (Only the rarely-used Korn shell has a built-in "true programming" language that's intended to be so.)
P.S.: cat any_language_bashing > /dev/null, please.