Deutsch   English   Français   Italiano  
<te5fld$7ao$1@shakotay.alphanet.ch>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder8.news.weretis.net!news.imp.ch!news.alphanet.ch!alphanet.ch!.POSTED!not-for-mail
From: Marc SCHAEFER <schaefer@alphanet.ch>
Newsgroups: fr.comp.lang.perl
Subject: =?ISO-8859-1?Q?D=E9r=E9f=E9rencement?= de hashes et passages de
 =?ISO-8859-1?Q?param=E8tres?=
Date: Wed, 24 Aug 2022 15:21:17 -0000 (UTC)
Organization: Posted through news.alphanet.ch
Message-ID: <te5fld$7ao$1@shakotay.alphanet.ch>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Aug 2022 15:21:17 -0000 (UTC)
Injection-Info: shakotay.alphanet.ch; posting-account="schaefer";
	logging-data="7512"; mail-complaints-to="usenet@alphanet.ch"; posting-host="634ce6c9682d817d72f6177875e2bb4f.nnrp.alphanet.ch"
User-Agent: tin/2.4.3-20181224 ("Glen Mhor") (UNIX) (Linux/4.19.0-21-amd64 (x86_64))
Cancel-Lock: sha256:1EkRHJjkR5lX3IDna7Gco/ALnCIWOLUE6wLl09WIyVo= sha256:PMJSXW+ll+QOdHPa3dgKvFo6IHNuYrWKzFKjriROm8U=
Bytes: 1827
Lines: 37

Bonjour,

$toto{bla} est la même chose que $toto{'bla'}, en général. Mais parfois
c'est mieux d'utiliser la version entre apostrophe ou guillements,
savez-vous les critères?

Autre question un peu similaire, pour le passage de paramètres nommés:

   #! /usr/bin/perl
   
   use strict;
   use warnings;
   
   use Data::Dumper;
   
   sub func {
      my %arg = @_;
   
      print Dumper(\%arg);
   }
   
   func(truc => 'bla', toto => 42);

on voit parfois (exemple: module CGI, bientôt obsolète):

   func(-truc => 'bla', -toto => 42);

Une idée quand utiliser l'une ou l'autre forme?

PS: ce dernier code sort:
$VAR1 = {
          'truc' => 'bla',
          'toto' => 42
        };
$VAR1 = {
          '-toto' => 42,
          '-truc' => 'bla'
        };