02-07-2012
You do realize that every time you run system() or backticks in perl, you waste an entire shell, right? To process all the shell code you're embedding in your perl? Meaning, your "perl" script is actually 99% shell code, using at least two external shells to do its job, and probably more if we saw the rest of your code? If you want to write perl, write perl; this isn't perl...
Furthermore, system() doesn't even work that way. system() doesn't return a string.
I think you can get much more usable output with --batch, which will cause it to not print the +------- fluff.
Last edited by Corona688; 02-07-2012 at 11:07 AM..
10 More Discussions You Might Find Interesting
1. HP-UX
Hi I have to eliminate all characters between ^ and a space in a file.
Following lines -
Test ^ H^@^@^@^@^@^@^B^VDM-BM-$|M-^_M-F^AM- File1
Test^H^@^@^@^@^@^F^A^X^@^SM-s^TM-3M-G^A File2
Should be printed as below
Test File1
Test File2
I used sed '/^/,/ /d' command, but it is not working.... (1 Reply)
Discussion started by: arsheshadri
1 Replies
2. UNIX for Dummies Questions & Answers
Hi all, I made a C++ program in dos (in dev-C++) and uploaded it on Solaris box. On opening that file with 'vim' editor i found that there is some extra new lines after each written code line. I tried to find out is the file is in dos or in unix format, with 'file' command,and i got "<file-name>.h:... (4 Replies)
Discussion started by: KornFire
4 Replies
3. Shell Programming and Scripting
Hi Folks,
I am writting a shell script for general purpose use....
i have created a function like below:-
largest_file()
{
clear
tput cup 20 30
echo please enter the full directory path where you want to search:-
tput cup 21 30
read lr_choice1
tput cup 22 30
echo please... (3 Replies)
Discussion started by: rpraharaj84
3 Replies
4. Shell Programming and Scripting
Hello,
I am using HP-UX B.11.23 U ia64 2591592275 unlimited-user license
I am trying to write a sh script on my own system to pass string of word as one parameter
The format of the string will be the same
But the content after : will be changed each time
If you manage to have this as $*... (7 Replies)
Discussion started by: fahad.m
7 Replies
5. Programming
I have a file like
1 0
2 0
3 1
3 0
4 0
6 1
6 0
. .
. .
. .
i need to eliminate values 3 0 and 6 0 in the same way there are such values in the whole file....but 3 1 and 6 1 shuld be present... (2 Replies)
Discussion started by: kamuju
2 Replies
6. Shell Programming and Scripting
Hi. Here's a tricky one (at least to me):
I have a file named theFile.txt (UTF-8) that contains the following:
a
b
cWhen I execute
perl -pe 's|a.*c|d|sg' theFile.txtin bash 3.2 on MAC OS X 10.6, I get no match, i.e. the result is
a
b
cagain. Any clues why? (2 Replies)
Discussion started by: BatManWSL
2 Replies
7. Shell Programming and Scripting
Hello, I'm having trouble to read two txt files, they have employee records line by line, I need to do the reading of a file that is old and compare it with the new base in the new file, deleting the lines in old file, then add the new file data from the old file and write to the database manager.... (5 Replies)
Discussion started by: selmar
5 Replies
8. Shell Programming and Scripting
Hi guys! I'm trying to eliminate some duplicates from a file but I'm like this :wall: !!!
My file looks like this:
ID_1 0.02
ID_2 2.4e-2
ID_2 4.3.e-9
ID_3 0.003
ID_4 0.2
ID_4 0.05
ID_5 1.2e-3
What I need is to eliminate all the duplicates considering the first column (in this... (6 Replies)
Discussion started by: gabrysfe
6 Replies
9. Shell Programming and Scripting
I am using something like this in my code
nawk 'BEGIN{OFS=FS="|"} {$15='$CalaMig'} {print}' filename
actually value of $CalaMig=01234
But its replacing as 1234 in the 15th postion.Its not taking the first zero.
can some one help here (1 Reply)
Discussion started by: saj
1 Replies
10. Shell Programming and Scripting
Hello,
I am trying to eliminate lines where column #1 is duplicated. If it is a duplicate, the line with the greater value in column #2 should be deleted:
file.dat
123 45.34
345 67.22
949 36.55
123 94.23
888 22.33
345 32.56
Desired ouput
123 45.34
949 36.55
888 22.33
345 32.56... (4 Replies)
Discussion started by: palex
4 Replies
LEARN ABOUT DEBIAN
text::micromason::texttemplate
MicroMason::TextTemplate(3pm) User Contributed Perl Documentation MicroMason::TextTemplate(3pm)
NAME
Text::MicroMason::TextTemplate - Alternate Syntax like Text::Template
SYNOPSIS
Instead of using this class directly, pass its name to be mixed in:
use Text::MicroMason;
my $mason = Text::MicroMason::Base->new( -TextTemplate );
Use the standard compile and execute methods to parse and evalute templates:
print $mason->compile( text=>$template )->( @%args );
print $mason->execute( text=>$template, @args );
Text::Template provides a syntax to mix Perl into a text template:
{ my $hour = (localtime)[2];
my $daypart = ( $hour > 11 ) ? 'afternoon' : 'morning';
'' }
Good { $daypart }, { $name }!
DESCRIPTION
This mixin class overrides several methods to allow MicroMason to emulate the template syntax and some of the other features of
Text::Template.
Compatibility with Text::Template
This is not a drop-in replacement for Text::Template, as the Perl calling interface is quite different, but it should be able to process
most existing templates without major changes.
This should allow current Text::Template users to take advantage of MicroMason's one-time compilation feature, which in theory could be
faster than Text::Template's repeated evals for each expression. (No benchmarking yet.)
Contributed patches to more closely support the syntax of Text::Template documents would be welcomed by the author.
Template Syntax
The following elements are recognized by the TextTemplate lexer:
o literal_text
Anything not specifically parsed by the below rule is interpreted as literal text.
o { perl_expr }
A Perl expression to be interpolated into the result.
Good { (localtime)[2]>11 ? 'afternoon' : 'morning' }.
The block may span multiple lines and is scoped inside a "do" block, so it may contain multiple Perl statements and it need not end
with a semicolon.
Good { my $h = (localtime)[2]; $h > 11 ? 'afternoon'
: 'morning' }.
To make a block silent, use an empty string as the final expression in the block.
{ warn "Interpreting template"; '' }
Hello there.
Although the blocks are not in the same a lexical scope, you can use local variables defined in one block in another:
{ $phase = (localtime)[2]>11 ? 'afternoon' : 'morning'; '' }
Good { $phrase }.
Argument Passing
Like Text::Template, this package clobbers a target namespace to pass in template arguments as package variables. For example, if you pass
in an argument list of "foo => 23", it will set the variable $foo in your package.
The strict pragma is disabled to facilitate these variable references.
Internally, this module inherits this functionality from the PassVariables mixin. If you are using the TextTemplate mixin, do not also
specify the PassVariables mixin or it will be included twice. For more information, see Text::MicroMason::PassVariables.
Supported Attributes
package
Target package namespace.
Private Methods
prepare()
If a package has not been specified, this method generates a new package namespace to use only for compilation of a single template.
lex()
Lexer for matched braces - produces only text and expr tokens. Uses Text::Balanced.
SEE ALSO
The interface being emulated is described in Text::Template.
For an overview of this templating framework, see Text::MicroMason.
This is a mixin class intended for use with Text::MicroMason::Base.
For distribution, installation, support, copyright and license information, see Text::MicroMason::Docs::ReadMe.
perl v5.10.1 2007-01-29 MicroMason::TextTemplate(3pm)