-
Notifications
You must be signed in to change notification settings - Fork 577
split continues past end of string #5179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From [email protected]#!/bin/perl -w $_ = " trash.prl -d -c f_trash.fponly.cmd -o f_trash.fponly print $_ ; prints the following: perl -V: Characteristics of this binary (from libperl): I have NOT attempted to narrow the problem past these eight lines. I hope JAPHW Nathan Zook __________________________________________________ |
From @tamiasOn Fri, Mar 01, 2002 at 04:42:20PM -0600, Nathan H Zook wrote: This is a bug in your script, rather than in perl.
This line is parsed as: (@cmdline = split), $cmdstr; which is equivalent to: (@cmdline = split " ", $_), $cmdstr; Presumably, you meant something like: @cmdline = split " ", $cmdstr; Ronald |
From [Unknown Contact. See original ticket]On Mar 1, Nathan H Zook said:
Perl has parsed that as (@cmdline = split), $cmdstr; so you end up splitting $_ on whitespace: (@cmdline = split ' ', $_), $cmdstr; Here's the Deparse output: pinyaj@vcmr-86 [5:58pm] ~ #106> perl -MO=Deparse,-p -e '@a = split, $b' If you had the -w switch on, you'd have been told $cmdstr was being used @cmdline = split ' ', $cmdstr; seems appropriate. -- |
From @mjdominusIt appears that the bug is in your program, not in Perl.
This line is equivalent to: (@cmdline = split), $cmdstr; which is why you got the "useless use of variable" warning. Since you trash.prl -d -c f_trash.fponly.cmd -o f_trash.fponly so that @cmdline gets: ('trash.prl', '-d', '-c', 'f_trash.fponly.cmd', If you want to split $cmdstr itself, you must use something like split ' ', $cmdstr; I hope this helps you with your problem.
Fine, but: 1) next time, please say what output you expected to get, in addition 2) next time, please don't change anything below the line that says Thanks for submitting your report. |
From [Unknown Contact. See original ticket]#!/bin/perl -w $_ = " trash.prl -d -c f_trash.fponly.cmd -o f_trash.fponly print $_ ; prints the following: perl -V: Characteristics of this binary (from libperl): I have NOT attempted to narrow the problem past these eight lines. I hope JAPHW Nathan Zook __________________________________________________ |
From [Unknown Contact. See original ticket]Doh! Thank-you gentlemen. The worst part is that I had -w on, and didn't JAPHW, Nathan The W, of course, having now been properly confirmed. __________________________________________________ On Fri, Mar 01, 2002 at 04:42:20PM -0600, Nathan H Zook wrote: This is a bug in your script, rather than in perl.
This line is parsed as: (@cmdline = split), $cmdstr; which is equivalent to: (@cmdline = split " ", $_), $cmdstr; Presumably, you meant something like: @cmdline = split " ", $cmdstr; Ronald |
Migrated from rt.perl.org#8740 (status was 'resolved')
Searchable as RT8740$
The text was updated successfully, but these errors were encountered: