我正在尝试从文本文件中过滤文件名
my $fname= "filenames.txt";
open (FPTR,$fname) || die "Can't Open File: $fname\n";
chomp(my @filenames = <FPTR>);
Run Code Online (Sandbox Code Playgroud)
文件的上下文如下
file1.pl
file2.pl
file3.pl
.
.
.
file100.pl
Run Code Online (Sandbox Code Playgroud)
但是当我打印 @filenames 数组时,它就像
';AR1 = 'file1.pl
';AR2 = 'file2.pl
';AR3 = 'file3.pl
';AR4 = 'file4.pl
.
.
.
.
$VAR100 = 'file100.pl';
Run Code Online (Sandbox Code Playgroud)
即使我添加了 chomp,新行也没有从数组元素中删除。
#include<stdio.h>
#include<conio.h>
#include<malloc.h>
void main()
{
struct node
{
int data;
struct node *next;
};
struct node *head,*temp;
int x;
clrscr();
head=(struct node *) malloc (sizeof(struct node));
temp=head;
while(temp!=NULL)
{
scanf("%d",x);
temp->data=x;
if(x==0)
{temp->next=NULL;}
else
{temp->next=(struct node *) malloc (sizeof(struct node));}
temp=temp->next;
}
}
Run Code Online (Sandbox Code Playgroud)
我正在编写一个简单的链接列表程序的代码...我可以成功运行该程序但是当我按0时程序没有停止..