Re: Using qr// with substitution and group-interpolation in thesubstitution part

2023-11-21 Thread gordonfish
On 10/25/23 10:32, Josef Wolf wrote: [...] Basically, I want to do the same as $data =~ s/^foo (whatever) bar$/bar $1 baz/mg; but with a different interface (because it has to be embedded into a bigger project), So I have come with this; sub substitute_lines { my ($contents,

Re: Using qr// with substitution and group-interpolation in the substitution part

2023-10-26 Thread Octavian Rasnita
ew Solomon" Cc: "Josef Wolf" ; Sent: Thursday, October 26, 2023 12:07 AM Subject: RE: Using qr// with substitution and group-interpolation in the substitution part Josef, Inspired by Levi's “eval” idea, here is my solution: sub substitute_lines { my ($content

RE: Using qr// with substitution and group-interpolation in the substitution part

2023-10-25 Thread Claude Brown via beginners
things" command on your system. -Original Message- From: Claude Brown via beginners Sent: Thursday, October 26, 2023 8:07 AM To: Levi Elias Nystad-Johansen ; Andrew Solomon Cc: Josef Wolf ; beginners@perl.org Subject: RE: Using qr// with substitution and group-interpolation

RE: Using qr// with substitution and group-interpolation in the substitution part

2023-10-25 Thread Claude Brown via beginners
Josef, Inspired by Levi's “eval” idea, here is my solution: sub substitute_lines { my ($contents, $regex, $subst) = @_; eval "\$contents =~ s/$regex/$subst/g"; return $contents; } $data = "foo whatever bar"; $data = &substitute_lines($data, qr/^foo (whatever) bar$/m, 'bar $1 baz'); p

Re: Using qr// with substitution and group-interpolation in the substitution part

2023-10-25 Thread Andrew Solomon
That's a fun question, Josef! I don't think you can pass a replacement phrase around, so this is all I came up with: sub substitute_lines { my ($contents, $subst) = @_; $contents = $subst->($contents); return $contents; } my $data = "foo whatever bar"; print(substitute_lines($data, sub { $

Using qr// with substitution and group-interpolation in the substitution part

2023-10-25 Thread Josef Wolf
Hallo all, maybe this is not exactly a beginner question, but I could not find an appropriate mailing list (all other lists seem to be developer realted). Basically, I want to do the same as $data =~ s/^foo (whatever) bar$/bar $1 baz/mg; but with a different interface (because it has to be

Re: interpolation without double quotes

2018-07-05 Thread Shlomi Fish
On Thu, 5 Jul 2018 09:58:52 -0500 p...@reason.net wrote: > Many thanks to Shlomi and Uri: as always, you’ve greatly boosted my > understanding of Perl! — Rick > You're welcome. -- - Shlomi Fish http://www.shlomifish.org/ ht

Re: interpolation without double quotes

2018-07-05 Thread perl
forgot to double quote the variable. >> >> my $student_directory = '/data/students/' . $student_id; >> > > see http://perl-begin.org/tutorials/bad-elements/#vars_in_quotes . Perl often > stringifies expressions even outside interpolation, such as when being >

Re: interpolation without double quotes

2018-07-04 Thread Shlomi Fish
Perl often stringifies expressions even outside interpolation, such as when being string-concatenated. > When I noticed this, I thought this was convenient: perl is trying to “do the > right thing.” But I worry that leaving them out may be bad coding practice; > if so, or you see other wort

Re: interpolation without double quotes

2018-07-04 Thread Uri Guttman
at leaving them out may be bad coding practice; if so, or you see other worthwhile improvements, please let me know. you don't need quotes on single scalar variables. in fact it is bad practice and can lead to bugs when you do that. what you did is not interpolation but ordinary concate

interpolation without double quotes

2018-07-04 Thread Rick T
The following line works, even though I forgot to double quote the variable. my $student_directory = '/data/students/' . $student_id; When I noticed this, I thought this was convenient: perl is trying to “do the right thing.” But I worry that leaving them out may be bad coding practice; if so,

Re: Interpolation Problem

2016-07-17 Thread David Mertens
To second what Uri mentioned already, On Fri, Jul 15, 2016 at 11:42 PM, AC P wrote: > > > Argument "$command" isn't numeric in subtraction (-) at then it gives me > my directory. > > > This error message (I suspect it was a warning, can you check?) probably reported a line number. Could you p

Re: Interpolation Problem

2016-07-16 Thread Uri Guttman
keep getting interpolated before even reaching the TL1 device. i think you misunderstand what interpolation means. in perl a scalar in a string is interpolated to its value. I predictably receive: Argument "$command" isn't numeric in subtraction (-) at then it gives me my di

Interpolation Problem

2016-07-16 Thread AC P
Hello Perl gurus, I'm hoping someone here can provide a solution since I'm stuck. I'm trying to send TL1 commands resembling "RTRV-ALM-ALL;" (the simplest command you can send as an example here) via Net::SSH::Expect but they keep getting interpolated before even reaching the TL1 device. I predi

Re: interpolation problem in emacspipe.pl script from emacswiki

2010-08-13 Thread Uri Guttman
uffer (get-buffer-create "*piped*")))' }); system( qq{ emacsclient -n --eval '(with-current-buffer "*piped*" (insert "$_"))' }); notice how much easier they are to read and you can see the "" are for emacs lisp and not for perl. act

interpolation problem in emacspipe.pl script from emacswiki

2010-08-13 Thread Gabriel Striewe
acspipe.pl, i run it through "sed s/\"//g", whereby deleting the double quotes. There must be something about the interpolation. Maybe somebody has an idea? I am not an expert at this. Gabriel -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

interpolation techniques (was Re: Here Docs)

2010-06-01 Thread Uri Guttman
>>>>> "t" == trapd00r writes: >> i would say to just use a temporary scalar variable. there is no shame >> in doing this and it is simpler than using the Interpolation module >> which is doing tied things and calling eval (which is dangerous).

Re: "Late" interpolation of a scalar variable inside a string

2009-03-14 Thread Chap Harrison
On Mar 14, 2009, at 5:24 PM, John W. Krahn wrote: Why not use sprintf() and '/foo/bar/%s/here' as the template: On Mar 14, 2009, at 5:19 PM, Chas. Owens wrote: * Search CPAN for template modules until you find one with the features you want, this one looks fairly close to what you want: htt

Re: "Late" interpolation of a scalar variable inside a string

2009-03-14 Thread John W. Krahn
Chap Harrison wrote: I want to compute a file pathname based on a "template" at runtime, when I know the value of a variable that the template uses. In other words, the template for the path name looks like this... /foo/bar/$project/here ...and I want to evaluate this expression once I have s

Re: "Late" interpolation of a scalar variable inside a string

2009-03-14 Thread Chas. Owens
On Sat, Mar 14, 2009 at 18:04, Chap Harrison wrote: > I want to compute a file pathname based on a "template" at runtime, when I > know the value of a variable that the template uses. > > In other words, the template for the path name looks like this... > > /foo/bar/$project/here snip > I've read

"Late" interpolation of a scalar variable inside a string

2009-03-14 Thread Chap Harrison
I want to compute a file pathname based on a "template" at runtime, when I know the value of a variable that the template uses. In other words, the template for the path name looks like this... /foo/bar/$project/here ...and I want to evaluate this expression once I have set the value of $pr

Re: Stopping variable interpolation/evaluation

2009-03-02 Thread pushkar . naik
> > Use print(), not printf(). > > -- > Gunnar Hjalmarsson > Email:http://www.gunnar.cc/cgi-bin/contact.pl- Hide quoted text - > > - Show quoted text - Thanx Gunnar and Octavian, print() and chomp() together did the job just fine. ~Pushkar -- To unsubscribe, e-mail: beginners-unsubscr...@perl.o

Re: Stopping variable interpolation/evaluation

2009-03-01 Thread Gunnar Hjalmarsson
pushkar.n...@gmail.com wrote: Hi, I have a line read in perl from a file that itself is a source code for languages like c/sv etc. The variable containing this line contains special characters like %d. When i print this line to another file, the %d is evaluated and a 0 is getting printed. How do

Re: Stopping variable interpolation/evaluation

2009-03-01 Thread Octavian Râsnita
From: Hi, I have a line read in perl from a file that itself is a source code for languages like c/sv etc. The variable containing this line contains special characters like %d. When i print this line to another file, the %d is evaluated and a 0 is getting printed. How do i overcome this and te

Stopping variable interpolation/evaluation

2009-03-01 Thread pushkar . naik
Hi, I have a line read in perl from a file that itself is a source code for languages like c/sv etc. The variable containing this line contains special characters like %d. When i print this line to another file, the %d is evaluated and a 0 is getting printed. How do i overcome this and tell perl t

Re: interpolation of function reference in a here doc

2007-07-05 Thread Brad Baxter
On Jul 2, 9:27 am, [EMAIL PROTECTED] (Rob Dixon) wrote: > Gabriel Striewe wrote: > > What do I do wrong? > > First of all, the ampersand subroutine designation is outdated and dangerous > and it is far better to use the indirect notation for a subroutine call: > > $hello->() > > Perl will interpola

Re: interpolation of function reference in a here doc

2007-07-03 Thread jenda
You may want to have a look at Interpolation.pm from CPAN. Jenda == [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == : What do people think? What, do people think? :-) -- Larry Wall in <[EMAIL PROTECTED]> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail

interpolation of function reference in a here doc

2007-07-02 Thread Gabriel Striewe
Dear List, I wanted to interpolate a function reference in a here doc. The following works fine: my $hello = sub { return "hello world!"; }; printf "hello $s\n", &$hello(); But when I use a heredoc instead, it doesn't work: print

Re: interpolation of function reference in a here doc

2007-07-02 Thread Rob Dixon
Gabriel Striewe wrote: I wanted to interpolate a function reference in a here doc. The following works fine: my $hello = sub { return "hello world!"; }; printf "hello $s\n", &$hello(); But when I use a heredoc instead, it doesn't work: print < First of all,

Re: interpolation of function reference in a here doc

2007-07-02 Thread Xavier Noria
rl printf is rarely used because double-quote strings allow interpolation of scalars and arrays, and because print accepts an arbitrary number of arguments. Interpolation does not understand function calls, though, so you either use a multi-argument call like this: print "hello "

Re: interpolation of function reference in a here doc

2007-07-02 Thread Adriano Ferreira
t when I use a heredoc instead, it doesn't work: print < You will encounter the problem if instead of printf "hello %s\n", &$hello(); you would have tried: print "hello &$hello()\n"; That's an issue with the rules of string interpolation. (Rea

Re: Interpolation of backslash-escapes

2006-11-04 Thread Rob Dixon
Randal L. Schwartz wrote: "Rob" == Rob Dixon <[EMAIL PROTECTED]> writes: Can anybody think of an elegant solution? Rob> eval "qq($val)"; s/elegant/hacky, dangerous, broken/ Consider $val = "), $yourcode_here, (". Old news, out of context, petulant. Rob -- To unsubscribe, e-mail: [EMAIL P

Re: Interpolation of backslash-escapes

2006-11-04 Thread Randal L. Schwartz
> "Rob" == Rob Dixon <[EMAIL PROTECTED]> writes: >> Can anybody think of an elegant solution? Rob> eval "qq($val)"; s/elegant/hacky, dangerous, broken/ Consider $val = "), $yourcode_here, (". -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 http://www.stonehe

Re: Interpolation of backslash-escapes

2006-11-03 Thread Rob Dixon
gt; Things I tried were for example >> $s= eval('' . "$val"); # (hoping to trigger the normal interpolation) or >> $s=~ s/\\(.)/"\\$1"/eg; >> but somehow i couldn't get it right ... >> >> Can anybody think of an elegant solution? > &

Re: Interpolation of backslash-escapes

2006-11-03 Thread John W. Krahn
Peter Daum wrote: > I am looking for an way to interpolate backslash-sequences > within a string with the usual perl semantics, e.g. > $s='1\t\2\t3\na\ b c' should become: > '123 > a b c' > > Things I tried were for example > $s= eval('' .

Re: Interpolation of backslash-escapes

2006-11-03 Thread Rob Dixon
Peter Daum wrote: > I am looking for an way to interpolate backslash-sequences within a string with the usual perl semantics, e.g. $s='1\t\2\t3\na\ b c' should become: '123 a b c' Things I tried were for example $s= eval('' . "$val"); # (hoping to

Re: Interpolation of backslash-escapes

2006-11-03 Thread Tom Phoenix
On 11/3/06, Peter Daum <[EMAIL PROTECTED]> wrote: I am looking for an way to interpolate backslash-sequences within a string with the usual perl semantics That's what eval does, although you have to build your string with care. Don't let the user put their own data into that string; they can (

Re: Interpolation of backslash-escapes

2006-11-03 Thread D. Bolliger
result is different :-) > Things I tried were for example > $s= eval('' . "$val"); # (hoping to trigger the normal interpolation) or > $s=~ s/\\(.)/"\\$1"/eg; > but somehow i couldn't get it right ... > > Can anybody think of an elegant solution

Interpolation of backslash-escapes

2006-11-03 Thread Peter Daum
I am looking for an way to interpolate backslash-sequences within a string with the usual perl semantics, e.g. $s='1\t\2\t3\na\ b c' should become: '123 a b c' Things I tried were for example $s= eval('' . "$val"); # (hoping to trigger the normal inter

interpolation problems (was: Re: help in regular expression)

2006-06-01 Thread Dr.Ruud
Irfan J Sayed schreef: > #!/usr/local/bin/perl > > use warnings; > use strict; Good! > my $file = "c:\backup.pl"; Use my $file = 'c:\backup.pl'; or rather my $file = 'c:/backup.pl'; > open(FH,$file) || die " can't open a file"; Make that: open my $fh, '<', $file or die "Err

Re: What is Variable Interpolation [was: Re: Help Required on the Script]

2006-04-07 Thread D. Bolliger
John W. Krahn am Freitag, 7. April 2006 01.09: > D. Bolliger wrote: > > btw, @04 is not a valid (array) variable name; they must not start with a > > digit, as not keyword/builtin does. > > $ perl -Mwarnings -Mstrict -le' our @04 = 10 .. 14; print "@04"' > 10 11 12 13 14 > > You are probably thinki

Re: What is Variable Interpolation [was: Re: Help Required on the Script]

2006-04-06 Thread John W. Krahn
D. Bolliger wrote: > > btw, @04 is not a valid (array) variable name; they must not start with a > digit, as not keyword/builtin does. $ perl -Mwarnings -Mstrict -le' our @04 = 10 .. 14; print "@04"' 10 11 12 13 14 You are probably thinking scalars and/or lexicals. John -- use Perl; program

What is Variable Interpolation [was: Re: Help Required on the Script]

2006-04-06 Thread D. Bolliger
Mazhar am Donnerstag, 6. April 2006 11.48: > thanks Raymond for the help it works, > and what do u mean by variable interpolation Hello Mazhar It will help you a lot to know and use the documentation system of perl. You can get an overview by typing (on the command line): perldoc perl

Re: interpolation

2006-01-16 Thread John Doe
print as: > >> > >>some perl $variable > >> > >>how can I force interpolation of '$variable'? > >> > >>one idea I thought of was: > >>#!/usr/bin/perl > >>my $var='variable'; > >>$string='some

Re: interpolation

2006-01-16 Thread Shawn Corey
John Doe wrote: The Ghost am Montag, 16. Januar 2006 06.34: I am storing text stings in a database. when I have the string: 'some perl $variable' which would print as: some perl $variable how can I force interpolation of '$variable'? one idea I thought of was: #!/

Re: interpolation

2006-01-15 Thread John Doe
The Ghost am Montag, 16. Januar 2006 06.34: > I am storing text stings in a database. when I have the string: > > 'some perl $variable' > > which would print as: > > some perl $variable > > how can I force interpolation of '$variable'? > > o

Re: interpolation

2006-01-15 Thread The Ghost
I am storing text stings in a database. when I have the string: 'some perl $variable' which would print as: some perl $variable how can I force interpolation of '$variable'? one idea I thought of was: #!/usr/bin/perl my $var='variable'; $string='some

Re: interpolation

2006-01-15 Thread John Doe
The Ghost am Freitag, 13. Januar 2006 21.23: > I know I could do that, but what if I don't know the variable names > in the string? > > > $sql=~s/\$Status/$Status/; > > could I do: > $sql=~s/\$(\S+)/${$1}/; > > On Jan 10, 2006, at 5:57 PM, John Doe wrote: > > The Ghost am Dienstag, 10. Januar 2006

Re: interpolation

2006-01-13 Thread The Ghost
I know I could do that, but what if I don't know the variable names in the string? $sql=~s/\$Status/$Status/; could I do: $sql=~s/\$(\S+)/${$1}/; On Jan 10, 2006, at 5:57 PM, John Doe wrote: The Ghost am Dienstag, 10. Januar 2006 21.57: I want to pull some text from a database: RxNumbe

Re: interpolation

2006-01-10 Thread John Doe
The Ghost am Dienstag, 10. Januar 2006 21.57: > I want to pull some text from a database: > > RxNumber in (select RxNumber FROM restoreReports WHERE Status in > $Status) > > then I want perl to use this string and interpolate the variables > ($Status). > > so: > > my $Status= "('New','Old')"; > my

Re: string interpolation when reading from a file

2006-01-10 Thread John Doe
n"; > print "K\t=>\t$k\n"; > > ### SQL_OUT is the filehandle that I am writing to > print SQL_OUT "$k\n"; $k _itself_ is interpolated into the double quoted string: $k contains a string with content looking like perl vars, $k is

Re: interpolation

2006-01-10 Thread Mike Blezien
Try changing your $Status variable to this: my $Status = '(' . '"' . join('","','New','Old') . '"' . ')'; that should give the results desired hope it helps. The Ghost wrote: I want to pull some text from a database: RxNumber in (select RxNumber FROM restoreReports WHERE Status in $Status)

interpolation

2006-01-10 Thread The Ghost
I want to pull some text from a database: RxNumber in (select RxNumber FROM restoreReports WHERE Status in $Status) then I want perl to use this string and interpolate the variables ($Status). so: my $Status= "('New','Old')"; my $sql=get_SQL_String(); #will get 'RxNumber in (select RxNum

string interpolation when reading from a file

2006-01-10 Thread Dan Huston
Greetings -- I am reading text sql commands) from a file, chopping it into sections and then writing each section out to a different file. Within the text are perl variables that I had expected to be interpolated as they were written out to the new file but they are not. Here is a sample lin

Re: Interpolation Problem with Matching

2005-03-08 Thread John W. Krahn
RICHARDS, JIM wrote: I am trying to compare files names listed in a file to the actual files in a directory. My code is as follows: Your "code" won't compile. Please add the following two lines: use warnings; use strict; to the top of your program and let perl help you find the mistakes. The best

RE: Interpolation Problem with Matching

2005-03-08 Thread Wagner, David --- Senior Programmer Analyst --- WGO
RICHARDS, JIM wrote: > I am trying to compare files names listed in a file to the actual > files in a directory. My code is as follows: > > > > Opendir(DIR,"name"); > > @files=readdir(DIR); > > > > Open(IN," > > > While() { > > If(/^pattern/) { > >

Interpolation Problem with Matching

2005-03-08 Thread RICHARDS, JIM
I am trying to compare files names listed in a file to the actual files in a directory. My code is as follows: Opendir(DIR,"name"); @files=readdir(DIR); Open(IN,") { If(/^pattern/) { moveFile($_); } } Close(IN); Sub moveFile() {

Re: second-level string interpolation

2004-03-13 Thread Michael C. Davis
At 10:39 AM 3/13/04 -0800, R. Joseph Newton wrote: >> my $header = <<'end_of_header'; >> # File: $filename >> end_of_header >> >> my $filename = 'xyz'; >> print $header, "\n"; # output: want to see # File: xyz, but get # File: >> $filename > >I am not sure how the above is any m

Re: second-level string interpolation

2004-03-13 Thread R. Joseph Newton
"Michael C. Davis" wrote: > Hi, Apologies if I'm bringing up a repeated topic. I searched the list > archive and the web and nothing specific has turned up so far. > > Is there a way to defer evaluation of the contents of a here-doc-defined > value such that one can embed variables in the here-d

Re: second-level string interpolation

2004-03-12 Thread Michael C. Davis
Thanks everyone for the great ideas. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: second-level string interpolation

2004-03-12 Thread david
Randy W. Sims wrote: > I just realized that this might be a little misleading. If you break it > down to: > > my $result = eval $header; > print $result; > > You will get an uninitialized value error. What happens is that > > eval $header > > is first interpolated to > > eval { # File: xyz }

Re: second-level string interpolation

2004-03-12 Thread Randy W. Sims
On 03/12/04 16:08, Randy W. Sims wrote: To elaborate a bit, the reason for the failure is that while the string is interpolated, it is then also evaluated as perl code, so in my $header = <<'end_of_header'; # File: $filename end_of_header my $filename = 'xyz'; print eval $header; the last stat

Re: second-level string interpolation

2004-03-12 Thread John W. Krahn
"Michael C. Davis" wrote: > > Hi, Apologies if I'm bringing up a repeated topic. I searched the list > archive and the web and nothing specific has turned up so far. > > Is there a way to defer evaluation of the contents of a here-doc-defined > value such that one can embed variables in the her

Re: second-level string interpolation

2004-03-12 Thread Randy W. Sims
On 03/12/04 16:35, david wrote: Michael C. Davis wrote: Is there a way to defer evaluation of the contents of a here-doc-defined value such that one can embed variables in the here-doc and not have them evaluated until they are used later? Something like this: code: - use strict;

RE: second-level string interpolation

2004-03-12 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Michael C. Davis wrote: > Hi, Apologies if I'm bringing up a repeated topic. I searched the > list archive and the web and nothing specific has turned up so far. > > Is there a way to defer evaluation of the contents of a > here-doc-defined value such that one can embed variables in the > here-d

Re: second-level string interpolation

2004-03-12 Thread david
Michael C. Davis wrote: > > Is there a way to defer evaluation of the contents of a here-doc-defined > value such that one can embed variables in the here-doc and not have them > evaluated until they are used later? Something like this: > > code: > - > use strict; > use warn

second-level string interpolation

2004-03-12 Thread Michael C. Davis
Hi, Apologies if I'm bringing up a repeated topic. I searched the list archive and the web and nothing specific has turned up so far. Is there a way to defer evaluation of the contents of a here-doc-defined value such that one can embed variables in the here-doc and not have them evaluated until

OT: referencing, derefrencing, and interpolation WAS: using a CONSTANT as a pathname

2003-06-02 Thread Todd W
"Tassilo Von Parseval" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sun, Jun 01, 2003 at 08:36:34PM -0400 Todd Wade wrote: > > > "Tassilo Von Parseval" <[EMAIL PROTECTED]> wrote in > > message news:[EMAIL PROTECTED] > > > On Sun, Jun 01, 2003 at 11:22:32AM +0200 Kevin Pfeiffer

RE: Best way to stop array interpolation.

2003-03-24 Thread Bob Showalter
Bakken, Luke wrote: > > > Here are two solutions I found: > > > > > > $rec->{"loans:a_$fld" . "[$i]"} = $tmp{$fld} || ''; > > > $rec->{"loans:a_$fld\[$i]"} = $tmp{$fld} || ''; > > > > > > Are there any other ways? Just curious. > > > > "loans:a_${fld}[$i]" also works. I like your second version

RE: Best way to stop array interpolation.

2003-03-24 Thread Bakken, Luke
> > Here are two solutions I found: > > > > $rec->{"loans:a_$fld" . "[$i]"} = $tmp{$fld} || ''; > > $rec->{"loans:a_$fld\[$i]"} = $tmp{$fld} || ''; > > > > Are there any other ways? Just curious. > > "loans:a_${fld}[$i]" also works. I like your second version > above best. > > $ perl -MO=Depar

Best way to stop array interpolation.

2003-03-24 Thread Bakken, Luke
Here's a quickie: I need to create a hash index out of a string that looks like this: loans:a_foo[0] If I build the index like this: $rec->{"loans:a_$fld[$i]"} = $tmp{$fld} || ''; perl thinks that $fld[$i] is an array element, which it isn't. Here are two solutions I found: $rec->{"loans:a_$

RE: Best way to stop array interpolation.

2003-03-24 Thread Bob Showalter
Bakken, Luke wrote: > Here's a quickie: > > I need to create a hash index out of a string that looks like this: > > loans:a_foo[0] > > If I build the index like this: > > $rec->{"loans:a_$fld[$i]"} = $tmp{$fld} || ''; > > perl thinks that $fld[$i] is an array element, which it isn't. > > Here

Re: Help with Hash values and variable interpolation

2002-11-08 Thread badchoice
> 112.58.26.32.32770 > 192.35.51.30.53: 64596[|domain] (DF) > 112.58.26.32.32770 > 192.100.59.110.53: 24685 [1au][|domain] (DF) > 112.58.26.4.2506 > 216.148.227.69.80: . ack 3280436924 win 2920 (DF) > 112.58.26.4.2506 > 216.148.227.69.80: . ack 1759 win 1162 (DF) > 112.58.26.4.2498 > 66.207.130.

Re: Help with Hash values and variable interpolation

2002-11-04 Thread John W. Krahn
Joshua Scott wrote: > > Hello all, Hello, > I've got a file which contains ports and hostnames. I'd like to count the > number of instances that each item occurs in my file. I'm having a > difficult time with this. > > This is my script: Basically I'm splitting the first line a few times to

RE: Help with Hash values and variable interpolation

2002-11-04 Thread Scott, Joshua
oshua [mailto:Joshua.Scott@;Jacobs.com] Sent: Monday, November 04, 2002 5:42 PM To: '[EMAIL PROTECTED]' Subject: Help with Hash values and variable interpolation Hello all, I've got a file which contains ports and hostnames. I'd like to count the number of instances that ea

Help with Hash values and variable interpolation

2002-11-04 Thread Scott, Joshua
Hello all, I've got a file which contains ports and hostnames. I'd like to count the number of instances that each item occurs in my file. I'm having a difficult time with this. This is my script: Basically I'm splitting the first line a few times to get the data I need. What am I doing wro

RE: Interpolation problem

2002-08-28 Thread Beau E. Cox
Thanks Japhy and Wags - I figured it was simple. Aloha => Beau. -Original Message- From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 28, 2002 8:18 AM To: Beau E. Cox Cc: [EMAIL PROTECTED] Subject: Re: Interpolation problem On Aug 28, Beau E.

Re: Interpolation problem

2002-08-28 Thread Jeff 'japhy' Pinyan
On Aug 28, Beau E. Cox said: >I can't figure this one out. I have a requirement >to grab from some sort of input the elements of a regular >expression and execute it. All is fine except when I use >$1, $2, ... in the substitution, as: This is in the FAQ, and one of the MOST commonly asked FAQs I

RE: Interpolation problem

2002-08-28 Thread David . Wagner
AIL PROTECTED]] Sent: Wednesday, August 28, 2002 11:07 To: [EMAIL PROTECTED] Subject: Interpolation problem Hi all - I can't figure this one out. I have a requirement to grab from some sort of input the elements of a regular expression and execute it. All is fine except when I use $1, $2, ... in the

Interpolation problem

2002-08-28 Thread Beau E. Cox
Hi all - I can't figure this one out. I have a requirement to grab from some sort of input the elements of a regular expression and execute it. All is fine except when I use $1, $2, ... in the substitution, as: #!/usr/bin/perl use strict; use warnings; $_ = 'beau cox'; my $match = '(\w+)\s+(\w+

Re: Pattern-Matching var - interpolation.

2002-07-19 Thread Connie Chan
hund 'k.a.t.z.e.' found at hund 'xyz' found at hund 'Connie' not found in Hund '123' found at hund Rgds, Connie ----- Original Message - From: "Sudarshan Raghavan" <[EMAIL PROTECTED]> To: "Perl beginners" <[EMAIL PROTECTED]> S

Re: Pattern-Matching var - interpolation.

2002-07-19 Thread Sudarshan Raghavan
On Fri, 19 Jul 2002, Sudarshan Raghavan wrote: > On Fri, 19 Jul 2002, Angerstein wrote: > > > Hello, > > I have a very unfunny problem, on which i am working for hours. > > > > I need to find out if a string contains an other specified string. > > I want to use pattern-matching. > > I can´t get

Re: Pattern-Matching var - interpolation.

2002-07-19 Thread Sudarshan Raghavan
On Fri, 19 Jul 2002, Angerstein wrote: > Hello, > I have a very unfunny problem, on which i am working for hours. > > I need to find out if a string contains an other specified string. > I want to use pattern-matching. > I can´t get a match together which make this. Look at my examples, > none o

Pattern-Matching var - interpolation.

2002-07-19 Thread Angerstein
Hello, I have a very unfunny problem, on which i am working for hours. I need to find out if a string contains an other specified string. I want to use pattern-matching. I can´t get a match together which make this. Look at my examples, none of the Matchings using vars works. If I replaces the va

Re: variable interpolation

2002-04-19 Thread bernabe diaz
gt;execute( CGI->param('NAME') ); > >Did you also print out the variable to prove that it does indeed contain >some data? Do you also have the RaiseError attribute turned on to die if >there are any SQL errors? > >Rob > > >-Original Message- >From:

RE: variable interpolation

2002-04-19 Thread Bob Showalter
> -Original Message- > From: bernabe diaz [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 19, 2002 10:18 AM > To: [EMAIL PROTECTED] > Subject: variable interpolation > > > Hi everyone, > could somebody help me with the following problem: > i have a

RE: variable interpolation

2002-04-19 Thread Hanson, Robert
t it does indeed contain some data? Do you also have the RaiseError attribute turned on to die if there are any SQL errors? Rob -Original Message- From: bernabe diaz [mailto:[EMAIL PROTECTED]] Subject: variable interpolation Thanks for help, but I tried that way too, and it does not wor

variable interpolation

2002-04-19 Thread bernabe diaz
hen I try to pass $variable_to a SQL statment the value of >> $variable_ was not passed >> so i can't fetch information fro the database. >> when i give the string to the SELECT statement directly every thing >> is fine, is working, that's why >>

Re: variable interpolation

2002-04-19 Thread bob ackerman
ot; SELECT something FROM some_table WHERE some_key= '$variable_' "); > then when I try to pass $variable_to a SQL statment the value of > $variable_ was not passed > so i can't fetch information fro the database. > when i give the string to the SELECT statement

variable interpolation

2002-04-19 Thread bernabe diaz
ng is fine, is working, that's why I consider that it is a problem of interpolation of the variable . could anybody help me Thanks, BD -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Variable Interpolation

2002-04-10 Thread Jenda Krynicky
From: [EMAIL PROTECTED] > Can you please help. > > When does Interpolation occur at Compile Time , Run Time or Both. So > far I know on both, then why does the following not work. ( how can I > get it to work ?) > > $scripts = 'cd $acu_home/bin \

Variable Interpolation

2002-04-10 Thread DBuitendag
Hi . Can you please help. When does Interpolation occur at Compile Time , Run Time or Both. So far I know on both, then why does the following not work. ( how can I get it to work ?) $scripts = 'cd $acu_home/bin \n nohup ${srv}_ss $srv.ini > $acu_home/bin/$srv.out&'; $acu_

Re: Question: Interpolation in Strings

2002-02-03 Thread Jenda Krynicky
From: "G. E." <[EMAIL PROTECTED]> > As I' ve read in "Programming Perl", double-quoted strings are subject > to variable interpolation of scalars and list values. Nothing else > interpolates. So the following perl code won't comp

Re: Question: Interpolation in Strings

2002-02-02 Thread Jeff 'japhy' Pinyan
On Feb 2, G. E. said: >As I' ve read in "Programming Perl", double-quoted strings are subject to >variable interpolation of scalars and list values. Nothing else >interpolates. >So the following perl code won't compile: > > $st = "!--- &ge

Re: Question: Interpolation in Strings

2002-02-02 Thread John W. Krahn
"G. E." wrote: > > As I' ve read in "Programming Perl", double-quoted strings are subject to > variable interpolation of scalars and list values. Nothing else > interpolates. > So the following perl code won't compile: > > $st

Question: Interpolation in Strings

2002-02-02 Thread G. E.
As I' ve read in "Programming Perl", double-quoted strings are subject to variable interpolation of scalars and list values. Nothing else interpolates. So the following perl code won't compile: $st = "!--- &get_header("Users")---!";

Re: Variable interpolation?

2002-01-07 Thread Mad B . Jones
06/01/02 17:20:37, Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> a écrit: >The contents of @string are raw text. You'll need to expand the variables >in it manually: > > perldoc -q 'expand variables' > >That FAQ will tell you what to do. Thanks, Jeff, for taking the time to answer. My problem was,

Re: Variable interpolation?

2002-01-06 Thread Jeff 'japhy' Pinyan
On Jan 6, Mad B.Jones said: >$name="Dave"; >$in="textfile.txt"; >open(INFILE, "<$in"); >@string=; >$string="$string[0]"; The contents of @string are raw text. You'll need to expand the variables in it manually: perldoc -q 'expand variables' That FAQ will tell you what to

Variable interpolation?

2002-01-06 Thread Mad B . Jones
Hi everyone. A little thing I fail to understand... This of course works: $name="Dave"; $string="Hello $name"; print $string; outputting: Hello Dave Why, then, does it not work when I get the string "Hello $name" out of a file? $name="Dave"; $in="textfile.txt"; open(I

Re: Left side variable interpolation during associative array assignment?

2001-12-31 Thread Peter Cornelius
er by year"; > my $arrayname = "\$sub$c"; > my $cursor = $dbh->prepare($SQL); > $cursor->execute; > while(@columns = $cursor->fetchrow){ > $arrayname{$columns[0]} = $columns[1]; #FAILED LEFT SIDE > INTERPOLATI

  1   2   >