On Tue, Oct 22, 2002 at 09:22:04AM +0300, Fogle Cpl Shawn B wrote: > my $i = /mnt/disk/sound/high_quality/how_now_brown_cow_ain't_happenin.flac; > > if ( /[']/ ) { > link /tmp/tmp_music_file $i; > system flac qq(flac -c -d /tmp/tmp_music_file | rawplay); > } > This is a very crude example (the syntax is probably incorrect also but > hopefully you can tell what I'm trying to accomplish) of something that > would be implemented in my program.
You're right, the syntax is incorrect, in many places. It's hard to diagnose your problem without solid and accurate examples of what you're doing. > my $i = /mnt/disk/sound/high_quality/how_now_brown_cow_ain\'t_happening.flac > system qq(flac -c -d $i | rawplay); If this is truly the way you had it before then perl should be complaining about a syntax error. You haven't quoted the string you're assigning to $i. > And it would output something like > flac can't play "/mnt/disk/sound/high_quality/how_now_brown_cow_ain'". Given this error, it may be perl chopping the string off, or it may be the shell. It's difficult to tell without an accurate example. If it is the shell having the problem then you've basically invoked the command: /bin/sh -c "flac -c -d /mnt/disk/sound/high_quality/how_now_brown_cow_ain't_happening.flac | rawplay" The shell is having a problem parsing it at that single quote. The solution is to escape it to the shell: system("flac -c -d \Q$i\E | rawplay"); You should always quote text when passing it to the shell if it has the potential to contain shell metacharacters (characters the shell will not interpret as a literal character). If that doesn't solve your problem you should reply with more complete code. > p.s. maybe a regexp to substitute would work...something like s/[']/[\']/g > but it doesn't seem to work..anyone? s/'/\\'/g will work to escape single quotes. I would suggest using quotemeta() or the \Q...\E syntax, though, because they will escape more than just single quotes. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]