Sponsored Content
Top Forums Shell Programming and Scripting Perl - Parentheses & Context confusion Post 302374928 by summer_cherry on Thursday 26th of November 2009 01:22:55 AM
Old 11-26-2009
Perl - Parentheses & Context confusion

Hi Expert,

Could you please explain why below two perl code get different result?

Thanks a lot.

Code:
sub test{
	return (2,3,4,5,6,3,4,50);
}

($a,$b)=(test)[1,4]; # 3,6

($a,$b)=test[1,4]; # 2,3

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parentheses in perl find/replace

I'm trying to use the following command to do a batch find and replace in all commonly named files through a file hierarchy find . -name 'file' |xargs perl -pi -e 's/find/replace/g' which works fine except for a substitution involving parenthesis. As a specific example I'm trying to sub... (3 Replies)
Discussion started by: Jeffish
3 Replies

2. Shell Programming and Scripting

Confusion about 1>&2 and 2>&1

Can anybody tell me the difference between 1>&2 and 2>&1? (1 Reply)
Discussion started by: navi
1 Replies

3. Shell Programming and Scripting

Perl regex help - matching parentheses

Let's say I'm trying to match potentially multiple sets of parentheses. Is there a way in a regular expression to force a match of closing parentheses specifically in the number of the opening parentheses? For example, if the string is "((foo bar))", I want to be able to say "match any number of... (7 Replies)
Discussion started by: cvp
7 Replies

4. Shell Programming and Scripting

Find & Replace string in multiple files & folders using perl

find . -type f -name "*.sql" -print|xargs perl -i -pe 's/pattern/replaced/g' this is simple logic to find and replace in multiple files & folders Hope this helps. Thanks Zaheer (0 Replies)
Discussion started by: Zaheer.mic
0 Replies

5. Solaris

Confusion in vxfs & ufs

Hi All, I have rootdg encapsulated within Veritas Volume Manager. /# vxprint -vg rootdg TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0 v rootvol root ENABLED 24585216 - ACTIVE - - v swapvol swap ENABLED 20484288 -... (3 Replies)
Discussion started by: solaris_1977
3 Replies

6. Shell Programming and Scripting

Opening Child Shell & Executing a script in the same context

Hi, Is the below possible (SHELL = tcsh)? -- I want to write an 'alias' something like this - alias set_my_work "setenv SOME_VAR;tcsh -i;source work_script.cshrc" The intention is to run this alias and enter a child shell, at the same time ensuring that the work_script.cshrc is source-ed.... (0 Replies)
Discussion started by: mishra.a.c
0 Replies

7. Shell Programming and Scripting

Confusion with "su -c" and quotes, user context switching?

Trying to execute commands for different Unix user with that user's environment variable context without fully switching as that user using sudo && su capabilities. Hoping this would help with security and not having to waste time switching between 10 different app users on same server. I do... (6 Replies)
Discussion started by: kchinnam
6 Replies

8. Shell Programming and Scripting

Wildcarding in a Perl @ARGV Context?

Hello folks! While "sedding" about again, I ran into this little conundrum du jour:#!/usr/bin/perl use strict; use warnings; use diagnostics; @ARGV = ('./afile.dat', './*.txt'); $^I = ''; while (<>) { s/Twinkies/Dinner/g; print; }When run, perl complains,...but, of... (1 Reply)
Discussion started by: LinQ
1 Replies

9. Shell Programming and Scripting

Wildcarding in a Perl @ARGV Context?

Hello folks! While "sedding" about again, I ran into this little conundrum du jour:#!/usr/bin/perl use strict; use warnings; use diagnostics; @ARGV = ('./afile.dat', './*.txt'); $^I = ''; while (<>) { s/Twinkies/Dinner/g; print; }When run, perl complains,...but, of... (2 Replies)
Discussion started by: LinQ
2 Replies

10. Shell Programming and Scripting

Questions related to if in awk context and if without awk context

I wrote this code, questions follow #! /bin/bash -f # Purpose - to show how if syntax is used within an awk clear; ls -l; echo "This will print out the first two columns of the inputted file in this directory"; echo "Enter filename found in this directory"; read input; ... (11 Replies)
Discussion started by: Seth
11 Replies
Pango::Cairo(3) 					User Contributed Perl Documentation					   Pango::Cairo(3)

NAME
Pango::Cairo METHODS
layout = Pango::Cairo::create_layout ($cr) o $cr (Cairo::Context) Pango::Cairo::error_underline_path ($cr, $x, $y, $width, $height) o $cr (Cairo::Context) o $x (double) o $y (double) o $width (double) o $height (double) Since: pango 1.14 Pango::Cairo::glyph_string_path ($cr, $font, $glyphs) o $cr (Cairo::Context) o $font (Pango::Font) o $glyphs (Pango::GlyphString) Pango::Cairo::layout_line_path ($cr, $line) o $cr (Cairo::Context) o $line (Pango::LayoutLine) Pango::Cairo::layout_path ($cr, $layout) o $cr (Cairo::Context) o $layout (Pango::Layout) Pango::Cairo::show_error_underline ($cr, $x, $y, $width, $height) o $cr (Cairo::Context) o $x (double) o $y (double) o $width (double) o $height (double) Since: pango 1.14 Pango::Cairo::show_glyph_string ($cr, $font, $glyphs) o $cr (Cairo::Context) o $font (Pango::Font) o $glyphs (Pango::GlyphString) Pango::Cairo::show_layout ($cr, $layout) o $cr (Cairo::Context) o $layout (Pango::Layout) Pango::Cairo::show_layout_line ($cr, $line) o $cr (Cairo::Context) o $line (Pango::LayoutLine) Pango::Cairo::update_context ($cr, $context) o $cr (Cairo::Context) o $context (Pango::Context) Pango::Cairo::update_layout ($cr, $layout) o $cr (Cairo::Context) o $layout (Pango::Layout) SEE ALSO
Pango COPYRIGHT
Copyright (C) 2003-2009 by the gtk2-perl team. This software is licensed under the LGPL. See Pango for a full notice. perl v5.12.1 2010-07-05 Pango::Cairo(3)
All times are GMT -4. The time now is 12:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy