Hi all
My question is related to following sample code which tries to change consant value by pointers.(I know it is wrong practice but i am surprised by mis-behaviour)
The code:
#include <stdio.h>
int main()
{
const int x = 10;
int *y;
const int * const z = &x;
y = (int *)&x;... (2 Replies)
I used the eval command in shell programming for assigning a value to a stored value of a variable.
Example:
VAR="Unix_Id"
eval $VAR="101"
eval echo $"$VAR"
How can i assign a value to a stored value of a variable in perl OR how i can write above code in Perl?
I need your help... (4 Replies)
Hello there,
I'd like to define a variable b equal to 0.5/a where a=0.001, so I wrote something like that:
a=0.001;
let 'b=0.5/$a';
but it doesn't work... maybe because the variable a has a real value???
Any help will be appreciated!!!:D (1 Reply)
Hi all,
some small script with eval turned me to crazy.
my OS is linux
Linux s10-1310 2.6.16.53-0.8.PTF.434477.3.TDC.0-smp #1 SMP Fri Aug 31 06:07:27 PDT 2007 x86_64 x86_64 x86_64 GNU/Linux
below script works well
#!/bin/bash
eval ssh remotehost date
eval ssh remotehost ls
below... (1 Reply)
Hi All,
I read the above written code (perl code) in another perl script and evaluates this code for each line of text file,but using exit statement in code make this not to work and i could not get the desired results. However if i use return it works fine. I just need to know why it doesn't... (1 Reply)
Hello All,
I am trying to use perl eval in a complex code and below given is a pseudo code of my logic.
Here $result evalutes to empty.
Please help.How should I retrieve of $t where $f just hold the name of varaible i.e t
$t=10;
$f='$t';
$result=eval "\$$f";
print "$result\n"; (3 Replies)
anyone has any info on why this is complaining???
vivek@vivek-c5e55ef2e ~/TAC
$ zoneCounter=1
vivek@vivek-c5e55ef2e ~/TAC
$ optUsage1=23%
vivek@vivek-c5e55ef2e ~/TAC
$ eval eval echo "<th>Zone $zoneCounter </th><th align=\"left\"> \$optUsage$zoneCounter </th>"
-bash: syntax error... (13 Replies)
Discussion started by: vivek d r
13 Replies
LEARN ABOUT DEBIAN
devel::argnames
Devel::ArgNames(3pm) User Contributed Perl Documentation Devel::ArgNames(3pm)NAME
Devel::ArgNames - Figure out the names of variables passed into subroutines.
SYNOPSIS
use Devel::ArgNames;
sub foo {
warn "foo() called with arguments: "
. join(", ", map { defined() ? $_ : "<unknown>" } arg_names(@_) );
}
foo($bar, $gorch, $blah[4]);
DESCRIPTION
When print-debugging code, you will often ind yourself going:
print "$foo is $foo, $bar is $bar"
With this module, you can write a reusable subroutine easily:
sub my_print_vars {
my %vars;
@vars{arg_names()} = @_;
foreach my $var ( keys %vars ) {
warn "$var is $vars{$var}
";
}
}
my_print_vars($foo, $bar);
This module doesn't provide dumping facilities because there are too many to choose from. This is a DIY kit ;-)
EXPORTS
arg_names [ $level ]
This function will return the names associated with the variables found on @_, at the level $level. If $level is not provided
"arg_names"'s caller's caller will be used ("$level == 2" in that case).
VERSION CONTROL
This module is maintained using Darcs. You can get the latest version from <http://nothingmuch.woobling.org/Devel-ArgNames/>, and use
"darcs send" to commit changes.
SEE ALSO
Data::Dumper::Simple, DB, Devel::Caller, Devel::Caller::Perl, PadWalker.
AUTHORS
Ran Eilam
Yuval Kogman <nothingmuch@woobling.org>
COPYRIGHT
Copyright (c) 2007 Yuval Kogman. All rights reserved
This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2008-01-02 Devel::ArgNames(3pm)