Pater matching and backreference
- From: Josef Moellers <josef.moellers@xxxxxxxxxxxxxxxxxxx>
- Date: Mon, 22 Aug 2005 09:07:17 +0200
Hi,
I am trying to escape spaces but apparently get into a naming conflict:
#! /usr/bin/perl
use warnings; use strict;
open(OGG, "ogginfo \"$ARGV[0]\" |") or die "$0: cannot open $ARGV[0]\n";
while (<OGG>) {
last if /^User comments section follows/;
}
while (<OGG>) {
chomp;
if (/^\s+title=(.*)/) {
my $title = $1;
$title =~ s/\s/\\$1/g;
print " --tt $title";
next;
}
if (/^\s+artist=(.*)/) {
my $artist = $1;
$artist =~ s/\s/\\$1/g;
print " --ta $artist";
next;
}
}
close OGG;
exit 0;If the artist or title name contains spaces, I get the error message
Use of uninitialized value in concatenation (.) or string at ./xinfo line 14, <OGG> line 14.
once for each space.
I assume this is due to the fact that $1 is defined when the substitute is compiled.
How can I do the substiture?
Josef -- Josef Möllers (Pinguinpfleger bei FSC) If failure had no penalty success would not be a prize -- T. Pratchett
.
- Follow-Ups:
- Re: Pater matching and backreference
- From: Tassilo v. Parseval
- Re: Pater matching and backreference
- From: Anno Siegel
- Re: Pater matching and backreference
- Prev by Date: Re: Implementing an English-Like Language - a Friendly Reply (Was:I just thought I'd ask..)
- Next by Date: $str1 eq $str2 causing problems
- Previous by thread: FAQ 4.22 How do I expand function calls in a string?
- Next by thread: Re: Pater matching and backreference
- Index(es):