#!/usr/bin/perl # Search for BEGIN NAV and END NAV markers # and insert the output of navbar.sh in between. # 1. read entire index.html into variable # 2. read new navbar from command shell # 3. string replace pattern # 4. overwrite index.html # 1. read entire index.html into variable open INDEX, "; while (!eof(INDEX)) { $index .= ; } close INDEX; # 2. read new navbar from command shell open CMD, "/bin/sh ./navbar.sh; while (!eof(CMD)) { $nav .= ; } close CMD; # remove trailing | $nav =~ s/\|\s*$/\n/; # 3. string replace pattern #$index =~ s/Nav:\s\[.*?\]/Nav: [ $nav]/s; $index =~ s/BEGIN NAV\:--\>.*?\