| Line | |
|---|
| 1 | #! /usr/bin/perl -w -ibak |
|---|
| 2 | # Copyright (2005) Reed A. Cartwright. All rights reserved. |
|---|
| 3 | # |
|---|
| 4 | # varrep.pl is used to substitute varables in files |
|---|
| 5 | # |
|---|
| 6 | # usage: perl varrep.pl file |
|---|
| 7 | # |
|---|
| 8 | # right now the only variable supported is #NUM# |
|---|
| 9 | # useful for modifying the code blocks of Nexus files produced by Dawg |
|---|
| 10 | # |
|---|
| 11 | # Distributed under the same license as DAWG |
|---|
| 12 | # |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | use strict; |
|---|
| 16 | |
|---|
| 17 | my %vars = (NUM => 0); |
|---|
| 18 | |
|---|
| 19 | while(<>) |
|---|
| 20 | { |
|---|
| 21 | $vars{NUM} = $1 if(/\[DataSet (\d+)\]/); |
|---|
| 22 | s/#(\w+)#/$vars{$1}/ge; |
|---|
| 23 | print $_; |
|---|
| 24 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.