This isn't a "variable inside a variable" (which is possible in Perl using references for example), but a bad excuse for an array. A literal translation of your code would be something like
Even shaved off a line and one unnecessary cat. Be prepared to do away with a lot of CSH workarounds now that you use a real scripting language.
Hey all,
perl - how can we name a variable base on the value of another variable?
for example in ksh/bash we do :
export c="100"
export x`echo $c`=2000
echo $x100
x100=2000
is it possible to do something similar for perl?
I already tried many ways but nothing is working.
I am... (3 Replies)
hi
I have a perl script from which I call a shell script and pass mail variable to it.
The mail works fine if I give 1 recipient but fails for multiple.
conv.pl:-
$mialing = "anu\@abc.com"
rest.sh $mialing
rest.sh
mail -s "hi" $1
This works fine
But I need to define multiple... (2 Replies)
Hi all,
I have a variable say var1 (output from somewhere, which I can't change)which store something like this:
echo $var1
name=fred
age=25
address="123 abc"
password=pass1234
how can I make the variable $name, $age, $address and $password contain the info?
I mean do this in a... (1 Reply)
Hi all
I've been working on a bash script parsing through debug/trace files and extracting all lines that relate to some search string. So far, it works pretty well. However, I am challenged by one requirement that is still open.
What I want to do:
1) parse through a file and identify all... (3 Replies)
Hi,
I have the following lines that I would like to see in an array for easy comparisons and printing:
Example 1:
field1,field2,field3,field4,field5
value1,value2,value3,value4,value5Example 2:
field1,field3,field4,field2,field5,field6,field7... (7 Replies)
Hi to All,
Please find below details.
file_config.config
export file1_status="SUCCESS"
export file2_status="SUCCESS"
file_one.sh
I am calling another two shell script from these script. I need to pass individual two script status (If it's "FAILED") to file_main.sh.
file_main.sh
I... (2 Replies)
I want to match the number exactly from the variable which has multiple numbers seperated by pipe symbol similar to search in egrep.below is the code which i tried
#!/usr/bin/perl
my $searchnum = $ARGV;
my $num = "148|1|0|256";
print $num;
if ($searchnum =~ /$num/)
{
print "found";
}... (2 Replies)
Hi, guys, i have a script i inherited from a coworker but i'm not perl savy. The script works but i would like it to work better. I want to run this command
./ciscomgrtest.pl -r "show version" -h hosts.router
and have the script goto each router in the hosts.router file and run the command... (2 Replies)
The red text at the bottom represents the three lines I want to address.
I'm dynamically creating a bsub with a perl script and would like to create the fasta_16S variable in a single line....not three. I'm having difficulty in getting the syntax correct. Obviously, there is some confusion... (3 Replies)
Experts,
I'm having problems with the code below.
I'm trying to test $var2 for two different regexs.
I thought it could be done per below, but I'm getting the following error when running.
$ ./test.pl b fed50c0100****
Unescaped left brace in regex is deprecated, passed through in regex; marked... (2 Replies)
Discussion started by: timj123
2 Replies
LEARN ABOUT DEBIAN
news::formarticle
FormArticle(3pm) User Contributed Perl Documentation FormArticle(3pm)NAME
News::FormArticle - derivative of News::Article
SYNOPSIS
use News::FormArticle;
See below for functions available.
DESCRIPTION
Like News::Article, but designed to be constructed from a file containing form text with substitutions.
Currently, the source text is substituted as follows:
Variables are denoted by $NAME or @NAME (where NAME is any simple identifier). (The sequences $$ and @@ denote literal $ and @ characters.)
Variables of the form $NAME are expected to supply scalar values which are interpolated; variables of the form @NAME are expected to supply
lists (or references to arrays) which are interpolated with separating newlines.
Values of variables are found by consulting the list of sources supplied. Each source may be either a reference to a hash, or a reference
to code.
Source hashes may contain as values either the desired value (scalar or reference to array), or a typeglob, or a code reference which will
be called to return the result. (Since typeglobs are allowed values, it is possible to supply a reference to a module symbol table as a
valid source.)
Code references supplied as sources are invoked with the variable name (including the leading $ or @) as the only parameter. In the
degenerate case, all variables accessible in the source scope may be made available for interpolation by supplying the following as a
source:
sub { eval shift }
If multiple sources are supplied, then each is consulted in turn until a defined value is found.
USAGE
use News::FormArticle;
Exports nothing.
Constructor
new ( FILE [, SOURCE [...]] )
Construct an article from the specified file, performing variable substitution with values supplied by the "SOURCE" parameters (see
Description). FILE is any form of data recognised by News::Article's read() method.
AUTHOR
Andrew Gierth <andrew@erlenstar.demon.co.uk>
COPYRIGHT
Copyright 1997 Andrew Gierth <andrew@erlenstar.demon.co.uk>
This code may be used and/or distributed under the same terms as Perl itself.
perl v5.10.1 2010-04-03 FormArticle(3pm)