10 More Discussions You Might Find Interesting
1. Homework & Coursework Questions
Hello :)
I created a little script that allow to make a rotation of values in an array. The goal was to shift the values to the right and that the last value of the array became the first value in order to create a rotation.
The purpose of the exercice was to do it without using a temporary... (6 Replies)
Discussion started by: Nexy
6 Replies
2. Shell Programming and Scripting
Hello :)
I created a little script that allow to make a rotation of values in an array. The goal was to shift the values to the right and that the last value of the array became the first value in order to create a rotation.
The purpose of the exercice was to do it without using a temporary... (3 Replies)
Discussion started by: Nexy
3 Replies
3. UNIX for Beginners Questions & Answers
Hello Experts,
I was trying to awk out some data out of a text file.
Below is a sample file which I have
xxx ***Wed Jun 28 18:00:59 CDT 2015
avg-cpu: %user %nice %system %iowait %steal %idle
17.10 0.00 4.56 2.86 0.00 75.48
Device: rrqm/s wrqm/s ... (2 Replies)
Discussion started by: DevAnand
2 Replies
4. Shell Programming and Scripting
I'm trying to exlude a list of values with perl to process while reading in a file. Is there a way to use the next if with a list?
Example:
@array = qw(val1 val2 val3 val6);
while (<>) {
next if $_ =~ @array; # values I don't want to process here
print; # process the rest here
}... (8 Replies)
Discussion started by: timj123
8 Replies
5. Shell Programming and Scripting
I know that
@food = %fruit;
Works. But how do I assign %fruit and %veggies to @food ? (2 Replies)
Discussion started by: popeye
2 Replies
6. UNIX for Advanced & Expert Users
Hi,
i want to search and replace array values by using perl
perl -pi -e "s/${d$i]}/${b$j]}" *.xml
i am using while loop for the same. if i excute this,it shows "Substitution replacement not terminated at -e line 1.".
please tell me what's wrong this line (1 Reply)
Discussion started by: arindam guha
1 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I'm trying to write a bash script that takes a file and passes each line from the file into an array with elements separated by column.
For example:
Sample file "file1.txt":
1 name1 a first
2 name2 b second
3 name3 c third
and have arrays such as:
line1 = ( "1" "name1" "a"... (3 Replies)
Discussion started by: ShiGua
3 Replies
8. Shell Programming and Scripting
Hi,
I have 2 arrays:
@names=qw(amith veena chaitra);
@files=qw(file.txt file1.txt file3.txt);
There is one to one relationship between names and files.
There needs to be mapping created between names and files.
The output should be like this:
amith --> file.txt
veena --->... (3 Replies)
Discussion started by: vanitham
3 Replies
9. Shell Programming and Scripting
Hi
can anyone suggest me how to write a file containing values,... say
19
20
21
22
..
40
to an array @array = (19, 20, ... 40)
-- Thanks (27 Replies)
Discussion started by: meghana
27 Replies
10. Shell Programming and Scripting
I have to add a variable value to an array, something like this:
......
@my_array_name = $value_of_this_variable;
This doesnt seem to work, any ideas why?
Thanks! (4 Replies)
Discussion started by: looza
4 Replies
Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrepUser Contributed Perl DocumentaPerl::Critic::Policy::BuiltinFunctions::RequireBlockGrep(3)
NAME
Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep - Write "grep { $_ =~ /$pattern/ } @list" instead of "grep /$pattern/, @list".
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
The expression forms of "grep" and "map" are awkward and hard to read. Use the block forms instead.
@matches = grep /pattern/, @list; #not ok
@matches = grep { /pattern/ } @list; #ok
@mapped = map transform($_), @list; #not ok
@mapped = map { transform($_) } @list; #ok
CONFIGURATION
This Policy is not configurable except for the standard options.
SEE ALSO
Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval
Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap
AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
COPYRIGHT
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license
can be found in the LICENSE file included with this module.
perl v5.16.3 2014-06-09 Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep(3)