Perl map doubt


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl map doubt
# 1  
Old 11-24-2009
Perl map doubt

Hello ,

Please can someone tell me what exactly happens when the below filehandler is chomped into an array and later mapped.

$lcpLog="logcopy\@".getTimestamp."\log";

open CFg ,"< $lcpcfg";
chomp(@cfg = <CFG>);
close CFG;

@cfg=grep { $_ ne ' ' } map { lc + (split /\s*\/\//) [0] } @cfg;

Please explain what happens in above line
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Understanding an example of perl map() function

Hello, I have many folders under which there is always a file with the same name, which contains the data I need to process later. A perl oneliner was borrowed perl -e 'print "gene_id\t", join("\t", map {/(.*)\//; $1} @ARGV),"\n";' *_test.trim/level.csvto make a header so that each column... (5 Replies)
Discussion started by: yifangt
5 Replies

2. Shell Programming and Scripting

Perl combine multiple map statements

I have a file like file. file.TODAY.THISYEAR file.TODAY.LASTYEARI want to substitute the words in caps with their actual values so that output should look like file.140805 file.140805.2014 file.140805.2013For this I am reading the file line bye line in an array and using multiple map... (1 Reply)
Discussion started by: sam05121988
1 Replies

3. Shell Programming and Scripting

Looping in Perl based on defined keys in Map

Hello All, I am writing the below script where it will connect to database and returns the results. #!/sw/gcm/perl510/bin/perl use SybaseC; &openConnection; &loadvalues; sub openConnection { $dbproc = new SybaseC(SYDB}, $ENV{DBDFLTUSR}, $ENV{DBDFLTPWD}); if... (2 Replies)
Discussion started by: filter
2 Replies

4. Shell Programming and Scripting

perl doubt

Hi, Please help me to understand the following code: perl -lne 'print if "$_ " =~ /(5 (?:\d+ ){5})\1/' What the regular expression "?:" does? Also, whether the expression "\1" is the same as in sed (i.e) printing the elements inside pair of parentheses? (3 Replies)
Discussion started by: royalibrahim
3 Replies

5. Shell Programming and Scripting

Trivial perl doubt about FILE

Hi, In the following perl code: #!/usr/bin/perl -w if (open(FILE, "< in_file")) { while (<FILE>) { chomp($_); if ($_ =~ /patt$/) { my $f = (split(" ", $_)); print "$f\n"; } } close FILE; } Why changing the "FILE" as... (4 Replies)
Discussion started by: royalibrahim
4 Replies

6. Shell Programming and Scripting

How to map the values of an array in perl?

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

7. Shell Programming and Scripting

Grep and map in perl

Hi guys, I'm trying to learn grep and map and having a little problem. Let's say I have a file which contains: Apple: abcdcabdadddbac I want to replace any combinations of three of abcd, thus when I do this: print grep {s/{3}/X/g} <F>; # will do the subtitution fine, output XXXX ... (1 Reply)
Discussion started by: new bie
1 Replies

8. Shell Programming and Scripting

Doubt in Perl Variable declaration

Anyone please say what is the difference between $var and ${var} in perl Sometimes $var used and sometimes ${var} used in same program. Thanks in Advance, Prabhu ---------- Post updated at 09:34 AM ---------- Previous update was at 05:59 AM ---------- Any one please clarify (1 Reply)
Discussion started by: prsampath
1 Replies

9. Shell Programming and Scripting

Perl script doubt?

Dear friends, I have two files. In first file first column ($1), i have numbers. The second file containes, the same number in the fourth column($4). I need a output file, matching the first file column 1 with second file column 4. The main thing is the output file lines will be sorted... (4 Replies)
Discussion started by: vasanth.vadalur
4 Replies

10. Shell Programming and Scripting

perl doubt plz explain....

hi all i wrote a shell script which uses perl script my code is : >cat filename | while read i >do >perl -e 'require "/home/scripts/abc.pl" ; abc("$i")' >done perl script used will simply check syntax of Cobol programs but it didn't work for me so i asked my colleague he suggested... (1 Reply)
Discussion started by: zedex
1 Replies
Login or Register to Ask a Question
pmap(1) 						      General Commands Manual							   pmap(1)

NAME
pmap, pfiles - displays process address information and open file descriptors SYNOPSIS
options] pid1 [pid2...] pid1 [pid2...] DESCRIPTION
prints the address space information of a process. prints information about all open file descriptors of a process. If file descriptor corresponds to a file, then prints the fstat(2) and fcntl(2) information. If the file descriptor corresponds to a socket, then prints socket related info, such as the socket type, socket family, and protocol family. In the case of AF_INET and AF_INET6 family of sockets, information about the peer host is also printed. pmap Options The information printed by can be controlled by the option. The argument to can be a comma-separated set of arguments given below: Display the size data locked in memory for each mapped object. Display the map name. This field can contain the following data. if the object is mapped as if the object mapped is the stack segment of the process. The object mapped is the text segment of the program. The object mapped is the data segment of the program. The object is mapped from a file. If the file name cannot be resolved, then the inode number and the device ID of the file is displayed. Also see the sec- tion below. Other map names include: and Display the offset of each mapped object. Specify access permission for each mapped object. Display the resident size of each mapped object. Display the space ID of each mapped object. Display the swap allocated for each mapped object. Display the maximum size of a page that can be allocated for the object. Indicate the type of data managed by each mapped object. The values include, Shared code, with n indicating the number of processes sharing the mapped object. Private code. Shared data, with n indicating the number of processes sharing the mapped object. Private data. Display the virtual size of each mapped object. Since the name of the file can be of variable length, use the name argument as the last argument to the option to ensure proper indentation of other fields. If no option is specified, prints the following fields by default: and EXTERNAL INFLUENCES
Environment Variables If is not specified or is null, it defaults to (see lang(5)). EXAMPLES
This command prints the virtual address, the resident memory size, and the name of each object mapped for processes with process ID 100 and 200: This command prints information on open file descriptors of processes with process ID 100 and 200: WARNINGS
and depend on to resolve the file names. If the file name cannot be resolved, then these commands will only print the device ID and the inode number of the file. Users of must not rely on the exact field widths and spacing of its output, as these will vary depending on the system and the release of HP-UX. SEE ALSO
fuser(1), ps(1), vmstat(1). pmap(1)