Why is Perl scripting used for Cisco equipment?
I recently saw a job advertised and they requite Perl scripting knowledge. I've often heard about people using Perl for Cisco (and other equipment), but have never actually researched this all the way.
I was wondering what do you actually use Perl for on cisco stuff
I was wondering what do you actually use Perl for on cisco stuff
2017 Certification Goals:
CCNP R/S
CCNP R/S
Comments
-
networker050184 Mod Posts: 11,962 ModMostly to make scripts for batch changes or do audits. For instance have the script log into 1,000 devices, check the config for certain syntax and add strings of commands based on whats found. Or something as simple as pushing an ACL update to 100 devices.An expert is a man who has made all the mistakes which can be made.
-
MAC_Addy Member Posts: 1,740 ■■■■□□□□□□Well that certainly makes sense. Wouldn't want to spend the day logging into 1,000 devices and changing a small piece of code. I appreciate it, networker!2017 Certification Goals:
CCNP R/S -
NetworkVeteran Member Posts: 2,338 ■■■■■■■■□□It can also be used to configure many similar items on the same device or to monitor many devices. E.g., check all your model xxx routers to see if they've hit or are about to hit a common fault and if so alert someone.
TCL and nowadays Python are also common choices.
There are also simpler tools where you 'record' your manual activities and they auto-convert them into scripts. -
JDMurray Admin Posts: 13,093 AdminFor organizations that use UNIX or Linux, or have devices based on UNIX or Linux, they already have Perl at their fingertips. Perl has also been well-used for sysadmin tasks for over 20 years now.
-
DoubleNNs Member Posts: 2,015 ■■■■■□□□□□Are Perl and Python similar enough that picking up Perl scripting would be easy, coming from a Python background?Goals for 2018:
Certs: RHCSA, LFCS: Ubuntu, CNCF CKA, CNCF CKAD | AWS Certified DevOps Engineer, AWS Solutions Architect Pro, AWS Certified Security Specialist, GCP Professional Cloud Architect
Learn: Terraform, Kubernetes, Prometheus & Golang | Improve: Docker, Python Programming
To-do | In Progress | Completed -
fiftyo Member Posts: 71 ■■□□□□□□□□Are Perl and Python similar enough that picking up Perl scripting would be easy, coming from a Python background?
Syntax wise, they are not similar. However, it would be _a lot_ easier picking perl up if you already know python. It would sort of being like learning juniper if you have a background in cisco. You know the underlying technologies, such as the protocols. But, syntax and hardware structure differ. As well one vendor bring some extra knobs to the table and vise versa. -
DoubleNNs Member Posts: 2,015 ■■■■■□□□□□Well I ask because I have a limited Python and Java background. So I know a little bit about coding/programming in general. I do intend on going down the Cisco route - I'm studying towards my ICND2 now.
I was more curious as to whether on the scripting side, it would be more beneficial to build up my Python skills (and possibly transition later), or simply go straight developing skills in a scripting language more commonly used w/ Cisco scripting.Goals for 2018:
Certs: RHCSA, LFCS: Ubuntu, CNCF CKA, CNCF CKAD | AWS Certified DevOps Engineer, AWS Solutions Architect Pro, AWS Certified Security Specialist, GCP Professional Cloud Architect
Learn: Terraform, Kubernetes, Prometheus & Golang | Improve: Docker, Python Programming
To-do | In Progress | Completed -
JDMurray Admin Posts: 13,093 Adminit would be _a lot_ easier picking perl up if you already know python.
print "and spend a lot of time debugging why your code doesn't work when you forget one.\n";
-
fiftyo Member Posts: 71 ■■□□□□□□□□Well I ask because I have a limited Python and Java background. So I know a little bit about coding/programming in general. I do intend on going down the Cisco route - I'm studying towards my ICND2 now.
I was more curious as to whether on the scripting side, it would be more beneficial to build up my Python skills (and possibly transition later), or simply go straight developing skills in a scripting language more commonly used w/ Cisco scripting.
Depends, the choice mainly comes down to preference imo. While someone who has programmed a lot in say C will prefer a language like perl, due to it's structure. But in the end, most of the time, you're trying to achieve a certain task and around atleast 80% of the cases the language wont play a huge role when it comes to system administration. I like python due to the fact I can achieve a lot without writing a huge ammount of code.
It's different if you do application programming where java(uuuggh) will be preferred due to code once, run everywhere.print "$Just $be $prepared $to $type $a $lot $of $dollar $signs,\n";
print "and spend a lot of time debugging why your code doesn't work when you forget one.\n";
Same thing goes if you forget tabs during if-statements in python. -
NetworkVeteran Member Posts: 2,338 ■■■■■■■■□□DoubleNN, I can write code in Python, TCL, Perl, and many other languages. If you already know a modern language like Python, I would just write your Cisco scripts using Python or Ruby, unless updating/maintaining code or a particularly library required doing otherwise. Python was invented with what many see as the deficiencies in Perl and other languages squarely in mind. It's also the direction employers tend to be moving towards, as opposed to the direction they're moving away from.
-
UnixGuy Mod Posts: 4,570 ModOr you can use BASH for simple tasks, no need to learn Perl nor Python if you want to automate simple tasks. Perl & Python are huge programming languages, and usually sysadmins know basic perl one-liners or small scripts to automate simple tasks (that can usually be accomplished using BASH).
-
DoubleNNs Member Posts: 2,015 ■■■■■□□□□□I think after passing my CCNA I'll spend a month or so looking over some Python and/or TCL. Probably won't be using either or those on the job this early in my career tho, so I'll just do a quick overview.Goals for 2018:
Certs: RHCSA, LFCS: Ubuntu, CNCF CKA, CNCF CKAD | AWS Certified DevOps Engineer, AWS Solutions Architect Pro, AWS Certified Security Specialist, GCP Professional Cloud Architect
Learn: Terraform, Kubernetes, Prometheus & Golang | Improve: Docker, Python Programming
To-do | In Progress | Completed -
About7Narwhal Member Posts: 761I think all of the Midrange (UNIX/Linux) guys where I work have at least 1 Perl book at their desks.