01-25-2002
chomp and chop in perl
What is the differnece between chomp and chop in perl?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi, I need to chope the header and footer record from an input file and make a new output file, please let me know how i can do it in unix.thanks. (4 Replies)
Discussion started by: coolbudy
4 Replies
2. Shell Programming and Scripting
A very naive question... I have a file which has many rows and many columns and I would like to chop off the rows and create a new file per row named after the first column of every row + 1. The data files look like:
# Donades de la trajectoria de la particula 60001
# 1:T 2:Massa 3:Rx 4:Ry 5:Rz... (7 Replies)
Discussion started by: pau
7 Replies
3. Shell Programming and Scripting
I am trying to use a script to replace the header of each file, whose filename are stored within the array $test, using the sed command within a Perl script as follows:
$count = 0;
while ( $count < $#test )
{
`sed -e 's/BIOGRF 321/BIOGRF 332/g' ${test} > 0`;
`cat 0 >... (2 Replies)
Discussion started by: userix
2 Replies
4. Shell Programming and Scripting
Hi ,
This script working for fine if pass script-name.sh Jul/10/2007 ,I want to pass 20070710(yyyymmdd) .Please any help it should be appereciated.
use Time::Local;
my $d = $ARGV;
my $t = $ARGV;
my $m = "";
@d = split /\//, $d;
@t = split /:/, $t;
if ( $d eq "Jan" ) { $m = 0 }... (7 Replies)
Discussion started by: akil
7 Replies
5. Shell Programming and Scripting
I am sure there should exist a chomp like Perl operator in Bash using which I can literally remove new line characters as show below:
Any clue? (3 Replies)
Discussion started by: paragkalra
3 Replies
6. Shell Programming and Scripting
How can i print the output of a perl script on a unix console and redirect the same in a log file under same directory simultaneously ?
Like in Shell script, we use tee, is there anything in Perl or any other option ? (2 Replies)
Discussion started by: butterfly20
2 Replies
7. Shell Programming and Scripting
I am completely new to perl programming. My father is helping me learn said programming language. However, I am stuck on one of the assignments he has given me, and I can't find very much help with it via google, either because I have a tiny attention span, or because I can be very very dense.
... (4 Replies)
Discussion started by: kittyluva2
4 Replies
8. UNIX for Advanced & Expert Users
we create a HP-UX software depot with a new perl-modul. after installation of the software depot, the perl module
i can't find with instmodsh in the inventory for installed Perl modules.
- i have learned of using instmodsh command : i find out what modules are already installed on my system.
... (0 Replies)
Discussion started by: bora99
0 Replies
9. Programming
My issue is that the perl script (as I have done it so far) created empty branches when I try to check some branches on existence.
I am using multydimentional hashes: found it as the best way for information that I need to handle. Saing multidimentional I means hash of hashes ... So, I have
... (2 Replies)
Discussion started by: alex_5161
2 Replies
10. Programming
I have reviewed many examples on-line about running another process (either PERL or shell command or a program), but do not find any usefull for my needs way. (Reviewed and not useful the system(), 'back ticks', exec() and open())
I would like to run another PERL-script from first one, not... (1 Reply)
Discussion started by: alex_5161
1 Replies
LEARN ABOUT DEBIAN
moosex::attributehelpers::trait::string
MooseX::AttributeHelpers::Trait::String(3pm) User Contributed Perl Documentation MooseX::AttributeHelpers::Trait::String(3pm)
NAME
MooseX::AttributeHelpers::String - simple string attribute
SYNOPSIS
package MyHomePage;
use Moose;
use MooseX::AttributeHelpers;
has 'text' => (
metaclass => 'String',
is => 'rw',
isa => 'Str',
default => sub { '' },
provides => {
append => "add_text",
replace => "replace_text",
}
);
my $page = MyHomePage->new();
$page->add_text("foo"); # same as $page->text($page->text . "foo");
DESCRIPTION
This module provides a simple string attribute, to which mutating string operations can be applied more easily (no need to make an lvalue
attribute metaclass or use temporary variables). Additional methods are provided for completion.
If your attribute definition does not include any of is, isa, default or provides but does use the "String" metaclass, then this module
applies defaults as in the "SYNOPSIS" above. This allows for a very basic counter definition:
has 'foo' => (metaclass => 'String');
$obj->append_foo;
METHODS
meta
method_provider
has_method_provider
helper_type
process_options_for_provides
Run before its superclass method.
check_provides_values
Run after its superclass method.
PROVIDED METHODS
It is important to note that all those methods do in place modification of the value stored in the attribute.
inc Increments the value stored in this slot using the magical string autoincrement operator. Note that Perl doesn't provide analogeous
behavior in "--", so "dec" is not available.
append $string
Append a string, like ".=".
prepend $string
Prepend a string.
replace $pattern $replacement
Performs a regexp substitution ("s" in perlop). There is no way to provide the "g" flag, but code references will be accepted for the
replacement, causing the regex to be modified with a single "e". "/smxi" can be applied using the "qr" operator.
match $pattern
Like replace but without the replacement. Provided mostly for completeness.
"chop"
"chop" in perlfunc
"chomp"
"chomp" in perlfunc
"clear"
Sets the string to the empty string (not the value passed to "default").
BUGS
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to
cpan-RT.
AUTHOR
Stevan Little <stevan@iinteractive.com>
COPYRIGHT AND LICENSE
Copyright 2007-2009 by Infinity Interactive, Inc.
<http://www.iinteractive.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2010-01-02 MooseX::AttributeHelpers::Trait::String(3pm)