in reply to Re^2: How do I use a template, csv file and script to generate multiple switch configurations
in thread How do I use a template, csv file and script to generate multiple switch configurations

Also, I seem to be having a bit of an issue with the perl configuration, or with the way the script is initializing, I get a bunch of odd errors like this:

hvanheerden@NWN-MNC-HVANHEE ~ $ perl makeconfig.pl > configtemplate.conf.txt Global symbol "$template_file_name" requires explicit package name at +makeconfig.pl line 7. Global symbol "$location" requires explicit package name at makeconfig +.pl line 10.

  • Comment on Re^3: How do I use a template, csv file and script to generate multiple switch configurations
  • Download Code

Replies are listed 'Best First'.
Re^4: How do I use a template, csv file and script to generate multiple switch configurations
by Laurent_R (Canon) on Apr 15, 2013 at 20:45 UTC

    You need to declare your variables before using them, using the "my" function. Change the relevant line to:

    my $template_file_name = "configtemplate.txt";

    Same things for other variables displaying the same error message.For example:

    my ($location, $hostname, $ip) = split ...
Re^4: How do I use a template, csv file and script to generate multiple switch configurations
by hdb (Monsignor) on Apr 15, 2013 at 21:45 UTC

    You also need to call it like perl makeconfig.pl < file_with_csv_variables.csv, otherwise you overwrite your template file.

      Ah, beautiful! That really helps! I was wondering how to fix it overwriting the template. Thanks!!