Sponsored Content
Top Forums Shell Programming and Scripting Understanding an example of perl map() function Post 303003551 by Corona688 on Friday 15th of September 2017 03:01:58 PM
Old 09-15-2017
You know what? When I execute this, it does return the ".trim" part. So that's one mystery solved. That trimming is either done before or after perl.

Code:
$ perl -e 'print "gene_id\t", join("\t", map {/(.*)\//; $1} @ARGV),"\n";' 1_test.trim/level.csv
gene_id 1_test.trim

$

This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

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 Replies)
Discussion started by: rmv
0 Replies

2. Shell Programming and Scripting

Help needed for understanding a function

There is a function called start: start() { echo -n $"Sending Startup Email: " echo "${RESTARTBODY}" | mutt -s "${RESTARTSUBJECT}" ${EMAIL} RETVAL=$? if ; then touch ${LOCKFILE} success else failure fi echo return ${RETVAL} } Can anyone explain what the bold part of the... (3 Replies)
Discussion started by: proactiveaditya
3 Replies

3. 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

4. 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

5. Shell Programming and Scripting

Help understanding some Perl code.

Well, I found myself trying to fix some Perl code (Ive never done any Perl in my life) and I pinpointed the place where the bug could be. But to be sure I have to know what does a few line of code mean: $files_lim =~ (/^\d*$/) $files_lim =~ (/^\d*h$/) $files_age =~ s/h// The code where... (2 Replies)
Discussion started by: RedSpyder
2 Replies

6. Shell Programming and Scripting

understanding thread in perl

Hi all, I am trying to build threads which will go to localhost and list the files in given folder. #!/usr/bin/perl use threads; my $t1 = threads->new(\&sub1, 1); my $t2 = threads->new(\&sub2, 2); push(@threads,$t1); push(@threads,$t2); foreach... (5 Replies)
Discussion started by: PranavEcstasy
5 Replies

7. 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

8. Shell Programming and Scripting

Need help understanding a function

Hello, I recently started going in depth with the shell, so I started learning from Linux Shell Scripting CookBook, 2nd edition. I am at the first chapter atm, and the author tells to define a function in the ~/.bashrc. The function is below. prepend() { && eval $1=\"$2':'\$$1\" && export... (1 Reply)
Discussion started by: Vaseer
1 Replies

9. 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

10. Shell Programming and Scripting

Problem with (Understanding) function

I have this code #!/bin/bash LZ () { RETVAL="\n$(date +%Y-%m-%d_%H-%M-%S) --- " return RETVAL } echo -e $LZ"Test" sleep 3 echo -e $LZ"Test" which I want to use to make logentrys on my NAS. I expect of this code that there would be output like 2017-03-07_11-00-00 --- Test (4 Replies)
Discussion started by: matrois
4 Replies
DateTime::Locale::ro(3) 				User Contributed Perl Documentation				   DateTime::Locale::ro(3)

NAME
DateTime::Locale::ro SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'ro' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Romanian. DATA
This locale inherits from the DateTime::Locale::root locale. It contains the following data. Days Wide (format) luni marXi miercuri joi vineri sambXtX duminicX Abbreviated (format) Lu Ma Mi Jo Vi Sa Du Narrow (format) L M M J V S D Wide (stand-alone) luni marXi miercuri joi vineri sambXtX duminicX Abbreviated (stand-alone) Lu Ma Mi Jo Vi Sa Du Narrow (stand-alone) L M M J V S D Months Wide (format) ianuarie februarie martie aprilie mai iunie iulie august septembrie octombrie noiembrie decembrie Abbreviated (format) ian. feb. mar. apr. mai iun. iul. aug. sept. oct. nov. dec. Narrow (format) I F M A M I I A S O N D Wide (stand-alone) ianuarie februarie martie aprilie mai iunie iulie august septembrie octombrie noiembrie decembrie Abbreviated (stand-alone) ian. feb. mar. apr. mai iun. iul. aug. sept. oct. nov. dec. Narrow (stand-alone) I F M A M I I A S O N D Quarters Wide (format) trimestrul I trimestrul al II-lea trimestrul al III-lea trimestrul al IV-lea Abbreviated (format) trim. I trim. II trim. III trim. IV Narrow (format) T1 T2 T3 T4 Wide (stand-alone) trimestrul I trimestrul al II-lea trimestrul al III-lea trimestrul al IV-lea Abbreviated (stand-alone) trim. I trim. II trim. III trim. IV Narrow (stand-alone) T1 T2 T3 T4 Eras Wide inainte de Hristos dupX Hristos Abbreviated i.Hr. d.Hr. Narrow i.Hr. d.Hr. Date Formats Full 2008-02-05T18:30:30 = marXi, 5 februarie 2008 1995-12-22T09:05:02 = vineri, 22 decembrie 1995 -0010-09-15T04:44:23 = sambXtX, 15 septembrie -10 Long 2008-02-05T18:30:30 = 5 februarie 2008 1995-12-22T09:05:02 = 22 decembrie 1995 -0010-09-15T04:44:23 = 15 septembrie -10 Medium 2008-02-05T18:30:30 = 05.02.2008 1995-12-22T09:05:02 = 22.12.1995 -0010-09-15T04:44:23 = 15.09.-010 Short 2008-02-05T18:30:30 = 05.02.2008 1995-12-22T09:05:02 = 22.12.1995 -0010-09-15T04:44:23 = 15.09.-010 Default 2008-02-05T18:30:30 = 05.02.2008 1995-12-22T09:05:02 = 22.12.1995 -0010-09-15T04:44:23 = 15.09.-010 Time Formats Full 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Long 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Medium 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Short 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 09:05 -0010-09-15T04:44:23 = 04:44 Default 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Datetime Formats Full 2008-02-05T18:30:30 = marXi, 5 februarie 2008, 18:30:30 UTC 1995-12-22T09:05:02 = vineri, 22 decembrie 1995, 09:05:02 UTC -0010-09-15T04:44:23 = sambXtX, 15 septembrie -10, 04:44:23 UTC Long 2008-02-05T18:30:30 = 5 februarie 2008, 18:30:30 UTC 1995-12-22T09:05:02 = 22 decembrie 1995, 09:05:02 UTC -0010-09-15T04:44:23 = 15 septembrie -10, 04:44:23 UTC Medium 2008-02-05T18:30:30 = 05.02.2008, 18:30:30 1995-12-22T09:05:02 = 22.12.1995, 09:05:02 -0010-09-15T04:44:23 = 15.09.-010, 04:44:23 Short 2008-02-05T18:30:30 = 05.02.2008, 18:30 1995-12-22T09:05:02 = 22.12.1995, 09:05 -0010-09-15T04:44:23 = 15.09.-010, 04:44 Default 2008-02-05T18:30:30 = 05.02.2008, 18:30:30 1995-12-22T09:05:02 = 22.12.1995, 09:05:02 -0010-09-15T04:44:23 = 15.09.-010, 04:44:23 Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (EEE d) 2008-02-05T18:30:30 = Ma 5 1995-12-22T09:05:02 = Vi 22 -0010-09-15T04:44:23 = Sa 15 Hm (H:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 PM 1995-12-22T09:05:02 = 9:05 AM -0010-09-15T04:44:23 = 4:44 AM Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 PM 1995-12-22T09:05:02 = 9:05:02 AM -0010-09-15T04:44:23 = 4:44:23 AM M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (d.M) 2008-02-05T18:30:30 = 5.2 1995-12-22T09:05:02 = 22.12 -0010-09-15T04:44:23 = 15.9 MEd (E, d MMM) 2008-02-05T18:30:30 = Ma, 5 feb. 1995-12-22T09:05:02 = Vi, 22 dec. -0010-09-15T04:44:23 = Sa, 15 sept. MMdd (dd.MM) 2008-02-05T18:30:30 = 05.02 1995-12-22T09:05:02 = 22.12 -0010-09-15T04:44:23 = 15.09 MMM (LLL) 2008-02-05T18:30:30 = feb. 1995-12-22T09:05:02 = dec. -0010-09-15T04:44:23 = sept. MMMd (d MMM) 2008-02-05T18:30:30 = 5 feb. 1995-12-22T09:05:02 = 22 dec. -0010-09-15T04:44:23 = 15 sept. MMMEd (E, d MMM) 2008-02-05T18:30:30 = Ma, 5 feb. 1995-12-22T09:05:02 = Vi, 22 dec. -0010-09-15T04:44:23 = Sa, 15 sept. MMMEEEd (EEE, d MMM) 2008-02-05T18:30:30 = Ma, 5 feb. 1995-12-22T09:05:02 = Vi, 22 dec. -0010-09-15T04:44:23 = Sa, 15 sept. MMMMd (d MMMM) 2008-02-05T18:30:30 = 5 februarie 1995-12-22T09:05:02 = 22 decembrie -0010-09-15T04:44:23 = 15 septembrie MMMMEd (E, d MMMM) 2008-02-05T18:30:30 = Ma, 5 februarie 1995-12-22T09:05:02 = Vi, 22 decembrie -0010-09-15T04:44:23 = Sa, 15 septembrie ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (M.yyyy) 2008-02-05T18:30:30 = 2.2008 1995-12-22T09:05:02 = 12.1995 -0010-09-15T04:44:23 = 9.-010 yMEd (EEE, d/M/yyyy) 2008-02-05T18:30:30 = Ma, 5/2/2008 1995-12-22T09:05:02 = Vi, 22/12/1995 -0010-09-15T04:44:23 = Sa, 15/9/-010 yMMM (MMM y) 2008-02-05T18:30:30 = feb. 2008 1995-12-22T09:05:02 = dec. 1995 -0010-09-15T04:44:23 = sept. -10 yMMMEd (EEE, d MMM y) 2008-02-05T18:30:30 = Ma, 5 feb. 2008 1995-12-22T09:05:02 = Vi, 22 dec. 1995 -0010-09-15T04:44:23 = Sa, 15 sept. -10 yMMMM (MMMM y) 2008-02-05T18:30:30 = februarie 2008 1995-12-22T09:05:02 = decembrie 1995 -0010-09-15T04:44:23 = septembrie -10 yQ ('trimestrul' Q y) 2008-02-05T18:30:30 = trimestrul 1 2008 1995-12-22T09:05:02 = trimestrul 4 1995 -0010-09-15T04:44:23 = trimestrul 3 -10 yQQQ (QQQ y) 2008-02-05T18:30:30 = trim. I 2008 1995-12-22T09:05:02 = trim. IV 1995 -0010-09-15T04:44:23 = trim. III -10 yyMM (MM.yy) 2008-02-05T18:30:30 = 02.08 1995-12-22T09:05:02 = 12.95 -0010-09-15T04:44:23 = 09.-10 yyMMM (MMM yy) 2008-02-05T18:30:30 = feb. 08 1995-12-22T09:05:02 = dec. 95 -0010-09-15T04:44:23 = sept. -10 yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 yyyyMM (MM.yyyy) 2008-02-05T18:30:30 = 02.2008 1995-12-22T09:05:02 = 12.1995 -0010-09-15T04:44:23 = 09.-010 yyyyMMMM (MMMM y) 2008-02-05T18:30:30 = februarie 2008 1995-12-22T09:05:02 = decembrie 1995 -0010-09-15T04:44:23 = septembrie -10 Miscellaneous Prefers 24 hour time? Yes Local first day of the week luni SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.18.2 2017-10-06 DateTime::Locale::ro(3)
All times are GMT -4. The time now is 12:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy