1. Is there any special reason why we are going for non-greddy matching(.+?)
2. In the first if statement , the delimiters are not provided properly. I think its treating ">" as redirection operator .
Hi,
i tried to combine grep with find and it didnt work
grep 'find dirname filename"
i also would like that the file will be sorted in the way.
thanks a lot. (2 Replies)
sed -e :a -e 's/<*>//g;/</N;//ba' a2.html -removes html tags
and
sed -i 's/YOURS TRULY/Joe Bob/' a2.html
Replaces a string with another string
can i make it into one string? (2 Replies)
Hello everyone! I currently work in the motion picture industry and we constantly receive lists of missing media from our sound department. I use a series of commands in TextWrangler in order to remake the lists into useable copy commands to automate the whole process but if I could make this work... (9 Replies)
Thanks in advance for any advice and help.
I have two lists of variables that I want to put into nested for loops.
for x in 1 2 3
do
for y in a b c
do
The output I want is:
filepath/1/ command modified by a
filepath/2/ command modified by b
filepath/3/ command modified by c
To... (10 Replies)
Hey everyone,
I am working in an environment where the different users can use ksh or csh. My situation is that I need the same result with one single command line.
I am searching for the real path the file is in.
My ksh input and output
ts2:ts2adm> cd $(dirname $(which sapcontrol)); pwd -P... (2 Replies)
I have the following sh-script:
konsole -T todo -e vi todo.txt &
konsole -T window1 -e ssh user@server &
konsole -T window2 -e ssh user@server2 -e cd directory &
The first two lines are working fine. The first opens a txt-file, the second opens a ssh-connection.
The third line... (6 Replies)
Command 1:
$script | grep 'Write to ECC( SSID=MARGIN)'
Command 2:
$script | grep 'is not greater than existing logical processing'
The above commands run my script and search the mentioned strings but I do not want to run my script twice. It is increasing run time.
Can someone tell me... (3 Replies)
Hello,
I have the following code. I wonder if it can be combined into 1 command.
y=`ls -1| tail -n 1`
m=${y%.abc}
Thank you. (3 Replies)
Discussion started by: april
3 Replies
LEARN ABOUT DEBIAN
devel::refcount
Devel::Refcount(3pm) User Contributed Perl Documentation Devel::Refcount(3pm)NAME
"Devel::Refcount" - obtain the REFCNT value of a referent
SYNOPSIS
use Devel::Refcount qw( refcount );
my $anon = [];
print "Anon ARRAY $anon has " . refcount($anon) . " reference
";
my $otherref = $anon;
print "Anon ARRAY $anon now has " . refcount($anon) . " references
";
DESCRIPTION
This module provides a single function which obtains the reference count of the object being pointed to by the passed reference value.
FUNCTIONS
$count = refcount($ref)
Returns the reference count of the object being pointed to by $ref.
COMPARISON WITH SvREFCNT
This function differs from "Devel::Peek::SvREFCNT" in that SvREFCNT() gives the reference count of the SV object itself that it is passed,
whereas refcount() gives the count of the object being pointed to. This allows it to give the count of any referent (i.e. ARRAY, HASH,
CODE, GLOB and Regexp types) as well.
Consider the following example program:
use Devel::Peek qw( SvREFCNT );
use Devel::Refcount qw( refcount );
sub printcount
{
my $name = shift;
printf "%30s has SvREFCNT=%d, refcount=%d
",
$name, SvREFCNT($_[0]), refcount($_[0]);
}
my $var = [];
printcount 'Initially, $var', $var;
my $othervar = $var;
printcount 'Before CODE ref, $var', $var;
printcount '$othervar', $othervar;
my $code = sub { undef $var };
printcount 'After CODE ref, $var', $var;
printcount '$othervar', $othervar;
This produces the output
Initially, $var has SvREFCNT=1, refcount=1
Before CODE ref, $var has SvREFCNT=1, refcount=2
$othervar has SvREFCNT=1, refcount=2
After CODE ref, $var has SvREFCNT=2, refcount=2
$othervar has SvREFCNT=1, refcount=2
Here, we see that SvREFCNT() counts the number of references to the SV object passed in as the scalar value - the $var or $othervar
respectively, whereas refcount() counts the number of reference values that point to the referent object - the anonymous ARRAY in this
case.
Before the CODE reference is constructed, both $var and $othervar have SvREFCNT() of 1, as they exist only in the current lexical pad. The
anonymous ARRAY has a refcount() of 2, because both $var and $othervar store a reference to it.
After the CODE reference is constructed, the $var variable now has an SvREFCNT() of 2, because it also appears in the lexical pad for the
new anonymous CODE block.
PURE-PERL FALLBACK
An XS implementation of this function is provided, and is used by default. If the XS library cannot be loaded, a fallback implementation in
pure perl using the "B" module is used instead. This will behave identically, but is much slower.
Rate pp xs
pp 225985/s -- -66%
xs 669570/s 196% --
SEE ALSO
o Test::Refcount - assert reference counts on objects
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
perl v5.14.2 2011-11-15 Devel::Refcount(3pm)